refactor: use apps_exists helper where appropriate

This centralizes the logic around checking if an application exists.
This commit is contained in:
Jose Diaz-Gonzalez
2018-04-02 00:37:10 -04:00
parent 5b4d6dc6eb
commit 72f53f9f1b
3 changed files with 13 additions and 8 deletions

View File

@@ -5,7 +5,13 @@ source "$PLUGIN_AVAILABLE_PATH/apps/functions"
apps_exists_cmd() {
declare desc="checks if an app exists"
local cmd="apps:exists"
apps_exists "$2"
[[ "$1" == "$cmd" ]] && shift 1
declare APP="$1"
if ! apps_exists "$APP"; then
dokku_log_fail "App does not exist"
fi
dokku_log_info1 "App already exists"
}
apps_exists_cmd "$@"