diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-01-17 14:36:40 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-01-17 12:53:19 -0800 |
commit | 58d16c1db9650e0da6f7c6ec5cc6fe8cc944f1ab (patch) | |
tree | 7a23241bb19d67e3f4394d913c5864b6398a1170 | |
parent | 5550f56115e785b34dadfdf05f8f2e90ffcf9713 (diff) | |
download | android_external_gello_build-58d16c1db9650e0da6f7c6ec5cc6fe8cc944f1ab.tar.gz android_external_gello_build-58d16c1db9650e0da6f7c6ec5cc6fe8cc944f1ab.tar.bz2 android_external_gello_build-58d16c1db9650e0da6f7c6ec5cc6fe8cc944f1ab.zip |
gello-build: streamline flag parsing
Change-Id: I9633d1dde3cf881e12327ae020f7f7bf29377cfb
-rwxr-xr-x | gello_build.sh | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/gello_build.sh b/gello_build.sh index ebe13fd..82922b6 100755 --- a/gello_build.sh +++ b/gello_build.sh @@ -145,38 +145,28 @@ function compile() { ## # Check Flags # -function checkflags() { - if [ "$1" == "--verbose" ] || [ "$2" == "--verbose" ] || - [ "$3" == "--verbose" ] || [ "$4" == "--verbose" ] || - [ "$5" == "--verbose" ]; then - VERBOSE=true - fi - - if [ "$1" == "--fast" ] || [ "$2" == "--fast" ] || - [ "$3" == "--fast" ] || [ "$4" == "--fast" ] || - [ "$5" == "--fast" ]; then - NOSYNC=true - FAST=true - fi - - if [ "$1" == "--no-sync" ] || [ "$2" == "--no-sync" ] || - [ "$3" == "--no-sync" ] || [ "$4" == "--no-sync" ] || - [ "$5" == "--no-sync" ]; then - NOSYNC=true - fi - - if [ "$1" == "--push" ] || [ "$2" == "--push" ] || - [ "$3" == "--push" ] || [ "$4" == "--push" ] || - [ "$5" == "--push" ]; then - PUSH=true - fi - - if [ "$1" == "--clean" ] || [ "$2" == "--clean" ] || - [ "$3" == "--clean" ] || [ "$4" == "--clean" ] || - [ "$5" == "--clean" ]; then - CLEAN=true - fi - +function parseflags() { + for flag in "$@" + do + case "$flag" in + --verbose) + VERBOSE=true + ;; + --fast) + NOSYNC=true + FAST=true + ;; + --no-sync) + NOSYNC=true + ;; + --push) + PUSH=true + ;; + --clean) + CLEAN=true + ;; + esac + done } @@ -219,7 +209,7 @@ elif [ "$1" == "--help" ]; then helpgello && exit 0 fi -checkflags $1 $2 $3 $4 $5 +parseflags "$@" sync && setup && compile |