diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-08-19 13:48:58 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-25 23:00:08 +0100 |
commit | b1f77ba41033397a2b25977963682b86f2f76471 (patch) | |
tree | 3046a10f52ba1161d6cd162e27ce42280050b2cb /scripts/contrib | |
parent | e3161654d75dfc3b059c519205b38b26e3ffb215 (diff) | |
download | openembedded-core-contrib-b1f77ba41033397a2b25977963682b86f2f76471.tar.gz |
build-perf-test-wrapper.sh: parse args with getopts
Use getopts for parsing the command line. This changes the usage so that
if a commit (to-be-tested) is defined it must be given by using '-c',
instead of a positional argument.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index e8e8021d58d..8eb4fdbc6ca 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh @@ -20,17 +20,33 @@ script=`basename $0` usage () { - echo "Usage: $script [COMMITISH]" +cat << EOF +Usage: $script [-h] [-c COMMITISH] [-C GIT_REPO] + +Optional arguments: + -h show this help and exit. + -c COMMITISH test (checkout) this commit +EOF } -if [ $# -gt 1 ]; then - usage - exit 1 -fi -commitish=$1 -echo "Running on `uname -n`" +# Parse command line arguments +commitish="" +while getopts "hc:" opt; do + case $opt in + h) usage + exit 0 + ;; + c) commitish=$OPTARG + ;; + *) usage + exit 1 + ;; + esac +done + +echo "Running on `uname -n`" if ! git_topdir=$(git rev-parse --show-toplevel); then echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" exit 1 |