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
2016-01-10 14:05:33 -05:00
committed by Michael Hobbs
parent a35e690a62
commit 76e27f0333
2 changed files with 9 additions and 1 deletions

4
dokku
View File

@@ -47,7 +47,9 @@ parse_args "$@"
args=("$@")
if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do
if [[ "$arg" =~ ^--.* ]]; then
if [[ "$arg" == "--app" ]]; then
shift 2
elif [[ "$arg" =~ ^--.* ]]; then
shift 1
else
break

View File

@@ -196,7 +196,9 @@ is_abs_path() {
}
parse_args() {
local next_index=1; local skip=false; local args=("$@")
for arg in "$@"; do
$skip && skip=false && continue
case "$arg" in
--quiet)
export DOKKU_QUIET_OUTPUT=1
@@ -210,7 +212,11 @@ parse_args() {
--force)
export DOKKU_APPS_FORCE_DELETE=1
;;
--app)
export DOKKU_APP_NAME=${args[$next_index]}; skip=true
;;
esac
next_index=$(( next_index + 1 ))
done
return 0
}