From 2bcad2014bdfa469c9fbf2a4f53040c86da396ce Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:26:19 -0600 Subject: [PATCH] chore: unify error output when an app is not declared --- docs/development/plugin-creation.md | 4 ++-- plugins/common/functions | 2 +- plugins/nginx-vhosts/subcommands/access-logs | 2 +- plugins/nginx-vhosts/subcommands/build-config | 2 +- plugins/storage/functions | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/development/plugin-creation.md b/docs/development/plugin-creation.md index 2a2134082..b8d5e1b8d 100644 --- a/docs/development/plugin-creation.md +++ b/docs/development/plugin-creation.md @@ -30,7 +30,7 @@ hello_main_cmd() { set -- $cmd $@ ## - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" local APP="$2"; @@ -58,7 +58,7 @@ hello_world_cmd() { set -- $cmd $@ ## - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" local APP="$2"; diff --git a/plugins/common/functions b/plugins/common/functions index 20cb21c46..86278277f 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -530,7 +530,7 @@ dokku_deploy_cmd() { source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/proxy/functions" - [[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy" + [[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on" local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") verify_app_name "$APP" plugn trigger pre-deploy "$APP" "$IMAGE_TAG" diff --git a/plugins/nginx-vhosts/subcommands/access-logs b/plugins/nginx-vhosts/subcommands/access-logs index 5b8fa8990..055d84713 100755 --- a/plugins/nginx-vhosts/subcommands/access-logs +++ b/plugins/nginx-vhosts/subcommands/access-logs @@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" nginx_logs_cmd() { declare desc="display app nginx logs from command line" local cmd="$1" - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" nginx_logs "$@" } diff --git a/plugins/nginx-vhosts/subcommands/build-config b/plugins/nginx-vhosts/subcommands/build-config index 212c8ef15..74b118da2 100755 --- a/plugins/nginx-vhosts/subcommands/build-config +++ b/plugins/nginx-vhosts/subcommands/build-config @@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" nginx_build_config_cmd() { declare desc="build nginx config to proxy app containers from command line" local cmd="nginx:build-config" - [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" nginx_build_config "$2" } diff --git a/plugins/storage/functions b/plugins/storage/functions index d65daeb26..6d2ec0a6c 100755 --- a/plugins/storage/functions +++ b/plugins/storage/functions @@ -6,7 +6,7 @@ storage_list_cmd() { declare desc="List all bound mounts" local cmd="storage:list" local passed_phases="deploy" - [[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list." + [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$2" && local APP="$2" echo "$APP volume bind-mounts:" get_bind_mounts "$(get_phase_file_path "$passed_phases")"