fix: properly handle argument parsing when skip is set to true

Previously, using the --app flag would mean that we would stop properly parsing all proceeding flags, so the --app flag would only work when set last.
This commit is contained in:
Jose Diaz-Gonzalez
2017-01-09 02:13:52 -07:00
parent 9272e40178
commit 594b41cc70

View File

@@ -251,7 +251,12 @@ parse_args() {
declare desc="top-level cli arg parser"
local next_index=1; local skip=false; local args=("$@")
for arg in "$@"; do
$skip && skip=false && continue
if [[ "$skip" == "true" ]]; then
next_index=$(( next_index + 1 ))
skip=false
continue
fi
case "$arg" in
--quiet)
export DOKKU_QUIET_OUTPUT=1
@@ -272,7 +277,7 @@ parse_args() {
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
;;
esac
local next_index=$(( next_index + 1 ))
next_index=$(( next_index + 1 ))
done
return 0
}