diff --git a/plugins/apps/commands b/plugins/apps/commands index d6a140f4b..84cd4b172 100755 --- a/plugins/apps/commands +++ b/plugins/apps/commands @@ -1,39 +1,11 @@ #!/usr/bin/env bash [[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | apps:help) - help_content_func () { - declare desc="return apps plugin help content" - cat< , Clones an app - apps:create , Create a new app - apps:destroy , Permanently destroy an app - apps:list, List your apps - apps:rename , Rename an app - apps:report [] [], Display report about an app -help_content - } - - if [[ $1 = "apps:help" ]] ; then - echo -e 'Usage: dokku apps[:COMMAND]' - echo '' - echo 'List your apps.' - echo '' - echo 'Example:' - echo '' - echo '$ dokku apps' - echo '=====> My Apps' - echo 'example' - echo 'example2' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + apps_help_cmd "$@" ;; *) diff --git a/plugins/apps/internal-functions b/plugins/apps/internal-functions index 1374bda6b..274132560 100755 --- a/plugins/apps/internal-functions +++ b/plugins/apps/internal-functions @@ -2,6 +2,43 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" +apps_help_content_func() { + declare desc="return apps plugin help content" + cat< , Clones an app + apps:create , Create a new app + apps:destroy , Permanently destroy an app + apps:list, List your apps + apps:rename , Rename an app + apps:report [] [], Display report about an app +help_content +} + +apps_help_cmd() { + if [[ $1 = "apps:help" ]] ; then + echo -e 'Usage: dokku apps[:COMMAND]' + echo '' + echo 'Manage Dokku apps' + echo '' + echo 'Example:' + echo '' + echo '$ dokku apps' + echo '=====> My Apps' + echo 'example' + echo 'example2' + echo '' + echo 'Additional commands:' + apps_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + apps_help_content_func + else + cat<