Skip to content

Commit

Permalink
refactor: validated bash code
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff committed Feb 10, 2017
1 parent ed57d8f commit 9ede660
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions testbed/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ run_ios=false
run_and=false
run_dep=false
run_cor=false
script_name=$(basename "$0")

# options
usage() {
printf "\n invalid usage"
printf "\n ./init.sh -h -> help"
printf "\n ./init.sh -i -> build ios"
printf "\n ./init.sh -a -> build android"
printf "\n ./init.sh -d -> reset node dependencies"
printf "\n ./init.sh -c -> reset cordova plugin"
printf "\n ./%s -h -> help" "$script_name"
printf "\n ./%s -i -> build ios" "$script_name"
printf "\n ./%s -a -> build android" "$script_name"
printf "\n ./%s -d -> reset node dependencies" "$script_name"
printf "\n ./%s -c -> reset cordova plugin" "$script_name"
printf "\n"
exit 1
}

if [[ "$#" < 1 ]]; then usage; fi
if [[ "$#" -lt 1 ]]; then usage; fi

for arg in "$@"; do
if ! [[ "$arg" =~ ^-. ]]; then usage; fi
Expand Down

0 comments on commit 9ede660

Please sign in to comment.