Add support for --app flag. Refs #1638

This change sets a DOKKU_APP_NAME env var, which can be used by plugins as a replacement for the `app` param if specified. Note that each plugin will have to manually shift it's arguments if necessary
This commit is contained in:
Jose Diaz-Gonzalez authored and Michael Hobbs committed 2016-03-03 22:11:35 -08:00
1 parent a35e690a62
commit 76e27f0333
2 files changed
+9 -1

No files matched your search

+3 -1
View File
@@ -47,7 +47,9 @@ parse_args "$@"
args=("$@") args=("$@")
if [[ "${args[0]}" =~ ^--.* ]]; then if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do for arg in "$@"; do
if [[ "$arg" =~ ^--.* ]]; then if [[ "$arg" == "--app" ]]; then
shift 2
elif [[ "$arg" =~ ^--.* ]]; then
shift 1 shift 1
else else
break break
+6
View File
@@ -196,7 +196,9 @@ is_abs_path() {
} }
parse_args() { parse_args() {
local next_index=1; local skip=false; local args=("$@")
for arg in "$@"; do for arg in "$@"; do
$skip && skip=false && continue
case "$arg" in case "$arg" in
--quiet) --quiet)
export DOKKU_QUIET_OUTPUT=1 export DOKKU_QUIET_OUTPUT=1
@@ -210,7 +212,11 @@ parse_args() {
--force) --force)
export DOKKU_APPS_FORCE_DELETE=1 export DOKKU_APPS_FORCE_DELETE=1
;; ;;
--app)
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
;;
esac esac
next_index=$(( next_index + 1 ))
done done
return 0 return 0
} }