diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index 2995231d7..3dbfc98d8 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,21 +1,15 @@ #!/usr/bin/env bash [[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" case "$1" in help | nginx:help) - - - if [[ $1 = "nginx:help" ]] ; then - help_formatted - else - help_content_func - fi - ;; + nginx_vhosts_help_cmd "$@" + ;; *) exit "$DOKKU_NOT_IMPLEMENTED_EXIT" - ;; + ;; esac diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 8f1af2c40..c68d9aa66 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -6,25 +6,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" source "$PLUGIN_AVAILABLE_PATH/domains/functions" source "$PLUGIN_AVAILABLE_PATH/ps/functions" -help_formatted (){ - echo -e 'Usage: dokku nginx[:COMMAND]' - echo '' - echo 'Interact with Dokku'"'"'s Nginx proxy.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, -} - -help_content_func () { - declare desc="return nginx plugin help content" - cat<, (Re)builds nginx config for given app - nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) - nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) -help_content - } - validate_nginx() { declare desc="validate entire nginx config" set +e diff --git a/plugins/nginx-vhosts/internal-functions b/plugins/nginx-vhosts/internal-functions new file mode 100755 index 000000000..93d929bb6 --- /dev/null +++ b/plugins/nginx-vhosts/internal-functions @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +nginx_vhosts_help_content_func() { + declare desc="return nginx plugin help content" + cat<, (Re)builds nginx config for given app + nginx:access-logs [-t], Show the nginx access logs for an application (-t follows) + nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) +help_content +} + +nginx_vhosts_help_cmd() { + if [[ $1 = "nginx:help" ]] ; then + echo -e 'Usage: dokku nginx[:COMMAND]' + echo '' + echo 'Interact with Dokku'"'"'s Nginx proxy.' + echo '' + echo 'Additional commands:' + nginx_vhosts_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + nginx_vhosts_help_content_func + else + cat<