diff --git a/plugins/00_dokku-standard/commands b/plugins/00_dokku-standard/commands index 7e830763a..56b37905c 100755 --- a/plugins/00_dokku-standard/commands +++ b/plugins/00_dokku-standard/commands @@ -1,28 +1,12 @@ #!/usr/bin/env bash -[[ " help help:help cleanup:help run:help trace:help url:help urls:help version:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +[[ " help help:help cleanup:help run:help url:help urls:help version:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/00_dokku-standard/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x case "$1" in - help | cleanup:help | run:help | trace:help | url:help | urls:help | version:help) - [[ $(echo "$1" | sed '/.*:help/!d') ]] && help_topic="${1%\:help}" - help_content_func() { - declare desc="return standard plugin help content" - cat <], Cleans up exited/dead Docker containers and removes dangling images - run [--env KEY=VALUE] , Run a command in a new container using the current application image - url , Show the first URL for an application (compatibility) - urls , Show all URLs for an application - version , Print dokku's version - help , Print the list of commands -help_content - } - - if [[ $help_topic ]]; then - help_content_func | sed "/^\s*$help_topic\s/!d" | sort | sed '/^.*:/d' | column -c2 -t -s, - else - help_content_func - fi + help | cleanup:help | run:help | url:help | urls:help | version:help) + cmd-standard-help "$@" ;; *) diff --git a/plugins/00_dokku-standard/help-functions b/plugins/00_dokku-standard/help-functions new file mode 100755 index 000000000..2c8bceef3 --- /dev/null +++ b/plugins/00_dokku-standard/help-functions @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-standard-help() { + declare desc="help command" + declare CMD="$1" + + [[ $(echo "$CMD" | sed '/.*:help/!d') ]] && help_topic="${CMD%\:help}" + if [[ $help_topic ]]; then + fn-help-content | sed "/^\s*$help_topic\s/!d" | sort | sed '/^.*:/d' | column -c2 -t -s, + else + fn-help-content + fi +} + +fn-help-content() { + declare desc="return help content" + cat <], Cleans up exited/dead Docker containers and removes dangling images + run [--env KEY=VALUE] , Run a command in a new container using the current application image + url , Show the first URL for an application (compatibility) + urls , Show all URLs for an application + version , Print dokku's version + help , Print the list of commands +help_content +} diff --git a/plugins/20_events/commands b/plugins/20_events/commands index 7ed6da3cc..84e73108d 100755 --- a/plugins/20_events/commands +++ b/plugins/20_events/commands @@ -1,30 +1,12 @@ #!/usr/bin/env bash [[ " help events:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/20_events/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x case "$1" in help | events:help) - help_content_func() { - declare desc="return events plugin help content" - cat < , Clones an app + apps:create , Create a new app + apps:destroy , Permanently destroy an app + apps:exists , Checks if an app exists + apps:list, List your apps + apps:lock , Locks an app for deployment + apps:locked , Checks if an app is locked for deployment + apps:rename , Rename an app + apps:report [] [], Display report about an app + apps:unlock , Unlocks an app for deployment +help_content +} diff --git a/plugins/apps/internal-functions b/plugins/apps/internal-functions index 3234cf0d1..7ed59bcf6 100755 --- a/plugins/apps/internal-functions +++ b/plugins/apps/internal-functions @@ -78,47 +78,6 @@ cmd-apps-report-single() { fi } -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:exists , Checks if an app exists - apps:list, List your apps - apps:lock , Locks an app for deployment - apps:locked , Checks if an app is locked for deployment - apps:rename , Rename an app - apps:report [] [], Display report about an app - apps:unlock , Unlocks an app for deployment -help_content -} - -cmd-apps-help() { - if [[ $1 == "apps:help" ]]; then - echo -e 'Usage: dokku apps[:COMMAND]' - echo '' - echo 'Manage Dokku apps' - echo '' - echo 'Example:' - echo '' - echo '$ dokku apps:list' - 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 <, [DEPRECATED] Alternative for certs:report + certs:add CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin + certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate + certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) + certs:info , [DEPRECATED] Alternative for certs:report + certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate + certs:remove , Remove an SSL Endpoint from an app + certs:report [] [], Displays an ssl report for one or more apps + certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app + certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin +help_content +} diff --git a/plugins/certs/internal-functions b/plugins/certs/internal-functions index a3aed6a95..76cdeaa92 100755 --- a/plugins/certs/internal-functions +++ b/plugins/certs/internal-functions @@ -71,39 +71,6 @@ cmd-certs-report-single() { fi } -certs_help_content_func() { - declare desc="return certs plugin help content" - cat <, [DEPRECATED] Alternative for certs:report - certs:add CRT KEY, Add an ssl endpoint to an app. Can also import from a tarball on stdin - certs:chain CRT [CRT ...], [NOT IMPLEMENTED] Print the ordered and complete chain for the given certificate - certs:generate DOMAIN, Generate a key and certificate signing request (and self-signed certificate) - certs:info , [DEPRECATED] Alternative for certs:report - certs:key CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate - certs:remove , Remove an SSL Endpoint from an app - certs:report [] [], Displays an ssl report for one or more apps - certs:rollback , [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app - certs:update CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin -help_content -} - -cmd-certs-help() { - if [[ $1 == "certs:help" ]]; then - echo -e 'Usage: dokku certs[:COMMAND]' - echo '' - echo 'Manage Dokku apps SSL (TLS) certs.' - echo '' - echo 'Additional commands:' - certs_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - certs_help_content_func - else - cat <, [DEPRECATED] Alternative for checks:report + checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** + checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) + checks:report [] [], Displays a checks report for one or more apps + checks:run [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list) + checks:skip [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list) +help_content +} diff --git a/plugins/checks/internal-functions b/plugins/checks/internal-functions index 58ff9a150..75dc5d3bf 100755 --- a/plugins/checks/internal-functions +++ b/plugins/checks/internal-functions @@ -65,35 +65,6 @@ cmd-checks-report-single() { fi } -checks_help_content_func() { - declare desc="return checks plugin help content" - cat <, [DEPRECATED] Alternative for checks:report - checks:disable [process-type(s)], Disable zero-downtime deployment for all processes (or comma-separated process-type list) ***WARNING: this will cause downtime during deployments*** - checks:enable [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list) - checks:report [] [], Displays a checks report for one or more apps - checks:run [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list) - checks:skip [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list) -help_content -} - -cmd-checks-help() { - if [[ $1 == "checks:help" ]]; then - echo -e 'Usage: dokku checks[:COMMAND]' - echo '' - echo 'Manage zero-downtime settings.' - echo '' - echo 'Additional commands:' - checks_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - checks_help_content_func - else - cat <|--global] + helpHeader = `Usage: dokku config[:COMMAND] -Display all global or app-specific config vars +Manage global and app-specific config vars Additional commands:` @@ -55,7 +55,7 @@ func main() { if err == nil && strings.Contains(string(output), "--all") { fmt.Println(helpContent) } else { - fmt.Print("\n config, Manages global and app-specific config vars\n") + fmt.Print("\n config, Manage global and app-specific config vars\n") } default: dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT")) diff --git a/plugins/docker-options/commands b/plugins/docker-options/commands index fdcf24568..f404d4a31 100755 --- a/plugins/docker-options/commands +++ b/plugins/docker-options/commands @@ -1,36 +1,9 @@ #!/usr/bin/env bash [[ " help docker-options:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/docker-options/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -docker_options_help_content_func() { - declare desc="return docker-options plugin help content" - cat < [phase(s)], [DEPRECATED] Alternative for docker-options:report - docker-options:add OPTION, Add Docker option to app for phase (comma separated phase list) - docker-options:clear [phase(s)], Clear a docker options from application with an optional phase (comma separated phase list) - docker-options:remove OPTION, Remove Docker option from app for phase (comma separated phase list) - docker-options:report [] [], Displays a docker options report for one or more apps -help_content -} - -cmd-docker-options-help() { - if [[ $1 == "docker-options:help" ]]; then - echo -e 'Usage: dokku docker-options[:COMMAND]' - echo '' - echo 'Display app'"'"'s Docker options for all phases.' - echo '' - echo 'Additional commands:' - docker_options_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - docker_options_help_content_func - else - cat < [phase(s)], [DEPRECATED] Alternative for docker-options:report + docker-options:add OPTION, Add Docker option to app for phase (comma separated phase list) + docker-options:clear [phase(s)], Clear a docker options from application with an optional phase (comma separated phase list) + docker-options:remove OPTION, Remove Docker option from app for phase (comma separated phase list) + docker-options:report [] [], Displays a docker options report for one or more apps +help_content +} diff --git a/plugins/domains/commands b/plugins/domains/commands index 695b00b66..482fbc229 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash [[ " help domains:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" -source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/domains/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x diff --git a/plugins/domains/help-functions b/plugins/domains/help-functions new file mode 100755 index 000000000..34e565a46 --- /dev/null +++ b/plugins/domains/help-functions @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-domains-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="domains" + local plugin_description="Manage domains used by the proxy" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <], [DEPRECATED] Alternative for domains:report + domains:add [ ...], Add domains to app + domains:add-global [ ...], Add global domain names + domains:clear , Clear all domains for app + domains:clear-global, Clear global domain names + domains:disable , Disable VHOST support + domains:enable , Enable VHOST support + domains:remove [ ...], Remove domains from app + domains:remove-global [ ...], Remove global domain names + domains:report [|--global] [], Displays a domains report for one or more apps + domains:set [ ...], Set domains for app + domains:set-global [ ...], Set global domain names +help_content +} diff --git a/plugins/domains/internal-functions b/plugins/domains/internal-functions index 89af4f890..f1d193448 100755 --- a/plugins/domains/internal-functions +++ b/plugins/domains/internal-functions @@ -84,41 +84,6 @@ cmd-domains-report-single() { fi } -domains_help_content_func() { - declare desc="return domains plugin help content" - cat <], [DEPRECATED] Alternative for domains:report - domains:add [ ...], Add domains to app - domains:add-global [ ...], Add global domain names - domains:clear , Clear all domains for app - domains:clear-global, Clear global domain names - domains:disable , Disable VHOST support - domains:enable , Enable VHOST support - domains:remove [ ...], Remove domains from app - domains:remove-global [ ...], Remove global domain names - domains:report [|--global] [], Displays a domains report for one or more apps - domains:set [ ...], Set domains for app - domains:set-global [ ...], Set global domain names -help_content -} - -cmd-domains-help() { - if [[ $1 == "domains:help" ]]; then - echo -e 'Usage: dokku domains[:COMMAND]' - echo '' - echo 'Manage vhost domains used by the Dokku proxy.' - echo '' - echo 'Additional commands:' - domains_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - domains_help_content_func - else - cat < [ || --container-id ], Connect to a specific app container -help_content - } - - if [[ $1 == "enter:help" ]]; then - echo -e 'Usage: dokku enter ' - echo '' - echo 'Allows you to access a bash prompt inside the container of the app.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + cmd-enter-help "$@" ;; *) diff --git a/plugins/enter/help-functions b/plugins/enter/help-functions new file mode 100755 index 000000000..3df2892e5 --- /dev/null +++ b/plugins/enter/help-functions @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-enter-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="enter" + local plugin_description="Enter running app containers" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat < [ || --container-id ], Connect to a specific app container +help_content +} diff --git a/plugins/git/commands b/plugins/git/commands index 365d6f65a..34afa72bd 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -3,6 +3,7 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_AVAILABLE_PATH/git/functions" source "$PLUGIN_AVAILABLE_PATH/git/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/git/help-functions" case "$1" in git-hook) diff --git a/plugins/git/help-functions b/plugins/git/help-functions new file mode 100755 index 000000000..f3f72bac0 --- /dev/null +++ b/plugins/git/help-functions @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-git-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="git" + local plugin_description="Manage app deploys via git" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, Initialize a git repository for an app + git:report [] [], Displays a git report for one or more apps + git:set (), Set or clear a git property for an app +help_content +} diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 5f87ab0fd..b497e2516 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -66,30 +66,3 @@ cmd-git-report-single() { [[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed" fi } - -git_help_content_func() { - declare desc="return git plugin help content" - cat <, Initialize a git repository for an app - git:report [] [], Displays a git report for one or more apps - git:set (), Set or clear a git property for an app -help_content -} - -cmd-git-help() { - if [[ $1 == "git:help" ]]; then - echo -e 'Usage: dokku git[:COMMAND]' - echo '' - echo 'Manages the git integration for an app.' - echo '' - echo 'Additional commands:' - git_help_content_func | sort | column -c2 -t -s, - echo '' - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - git_help_content_func - else - cat < [-h] [-t] [-n num] [-q] [-p process], Display recent log output + logs:failed , Show the last logs for an application +help_content +} diff --git a/plugins/logs/internal-functions b/plugins/logs/internal-functions index 1a79c4159..dbefa3041 100755 --- a/plugins/logs/internal-functions +++ b/plugins/logs/internal-functions @@ -12,28 +12,3 @@ fn-logs-usage() { echo " -t, --tail # continually stream logs" echo " -q, --quiet # display raw logs without colors, time and names" } - -fn-logs-help-content() { - declare desc="return logs plugin help content" - cat < [-h] [-t] [-n num] [-q] [-p process], Display recent log output - logs:failed , Show the last logs for an application -help_content -} - -cmd-logs-help() { - if [[ $1 == "logs:help" ]]; then - echo -e 'Usage: dokku logs[:COMMAND]' - echo '' - echo 'Output app logs' - echo '' - echo 'Additional commands:' - fn-logs-help-content | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - fn-logs-help-content - else - cat <, Creates an attachable docker network - network:destroy , Destroys a docker network - network:exists , Checks if a docker network exists - network:info , Outputs information about a docker network - network:list, Lists all docker networks + network:create , Creates an attachable docker network + network:destroy , Destroys a docker network + network:exists , Checks if a docker network exists + network:info , Outputs information about a docker network + network:list, Lists all docker networks network:report [] [], Displays a network report for one or more apps network:rebuild , Rebuilds network settings for an app network:rebuildall, Rebuild network settings for all apps @@ -47,7 +47,7 @@ func main() { if err == nil && strings.Contains(string(output), "--all") { fmt.Println(helpContent) } else { - fmt.Print("\n network, Manages network settings for an app\n") + fmt.Print("\n network, Manage network settings for an app\n") } default: dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT")) diff --git a/plugins/nginx-vhosts/commands b/plugins/nginx-vhosts/commands index bc88b28a2..a9d08e243 100755 --- a/plugins/nginx-vhosts/commands +++ b/plugins/nginx-vhosts/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash [[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" -source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x diff --git a/plugins/nginx-vhosts/help-functions b/plugins/nginx-vhosts/help-functions new file mode 100755 index 000000000..d8e660210 --- /dev/null +++ b/plugins/nginx-vhosts/help-functions @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-nginx-vhosts-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="nginx" + local plugin_description="Manage the nginx proxy" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat < [-t], Show the nginx access logs for an application (-t follows) + nginx:build-config , (Re)builds nginx config for given app + nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) + nginx:report [] [], Displays an nginx report for one or more apps + nginx:set (), Set or clear an nginx property for an app + nginx:show-conf , Display app nginx config + nginx:validate [] [--clean], Validates and optionally cleans up invalid nginx configurations +help_content +} diff --git a/plugins/nginx-vhosts/internal-functions b/plugins/nginx-vhosts/internal-functions index 51e7673e2..a79a69ef8 100755 --- a/plugins/nginx-vhosts/internal-functions +++ b/plugins/nginx-vhosts/internal-functions @@ -204,36 +204,6 @@ nginx_vhosts_conf_clean_func() { rm -f "$NGINX_CONF" } -nginx_vhosts_help_content_func() { - declare desc="return nginx plugin help content" - cat < [-t], Show the nginx access logs for an application (-t follows) - nginx:build-config , (Re)builds nginx config for given app - nginx:error-logs [-t], Show the nginx error logs for an application (-t follows) - nginx:report [] [], Displays an nginx report for one or more apps - nginx:set (), Set or clear an nginx property for an app - nginx:show-conf , Display app nginx config - nginx:validate [] [--clean], Validates and optionally cleans up invalid nginx configurations -help_content -} - -cmd-nginx-vhosts-help() { - 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 <, Disable an installed plugin (third-party only) - plugin:enable , Enable a previously disabled plugin - plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]], Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones) - plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones) - plugin:list, Print active plugins - plugin:trigger , Trigger an arbitrary plugin hook - plugin:uninstall , Uninstall a plugin (third-party only) - plugin:update [name [committish]], Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins -help_content - } - - if [[ $1 == "plugin:help" ]]; then - echo -e 'Usage: dokku plugin[:COMMAND]' - echo '' - echo 'View installed plugins and manage community plugins.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + cmd-plugin-help "$@" ;; *) diff --git a/plugins/plugin/help-functions b/plugins/plugin/help-functions new file mode 100755 index 000000000..b30b86660 --- /dev/null +++ b/plugins/plugin/help-functions @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-plugin-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="plugin" + local plugin_description="Manage installed plugins" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, Disable an installed plugin (third-party only) + plugin:enable , Enable a previously disabled plugin + plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]], Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones) + plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones) + plugin:list, Print active plugins + plugin:trigger , Trigger an arbitrary plugin hook + plugin:uninstall , Uninstall a plugin (third-party only) + plugin:update [name [committish]], Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins +help_content +} diff --git a/plugins/proxy/commands b/plugins/proxy/commands index 4ac263c8e..742fe187d 100755 --- a/plugins/proxy/commands +++ b/plugins/proxy/commands @@ -1,6 +1,6 @@ #!/usr/bin/env bash [[ " help proxy:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" -source "$PLUGIN_AVAILABLE_PATH/proxy/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/proxy/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x diff --git a/plugins/proxy/help-functions b/plugins/proxy/help-functions new file mode 100755 index 000000000..fb84aa123 --- /dev/null +++ b/plugins/proxy/help-functions @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-proxy-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="proxy" + local plugin_description="Manage the proxy integration for an app" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, [DEPRECATED] Show proxy settings for app + proxy:disable , Disable proxy for app + proxy:enable , Enable proxy for app + proxy:ports , List proxy port mappings for app + proxy:ports-add [::...], Add proxy port mappings to an app + proxy:ports-clear , Clear all proxy port mappings for an app + proxy:ports-remove [|::...], Remove specific proxy port mappings from an app + proxy:ports-set [::...], Set proxy port mappings for an app + proxy:report [] [], Displays a proxy report for one or more apps + proxy:set , Set proxy type for app +help_content +} diff --git a/plugins/proxy/internal-functions b/plugins/proxy/internal-functions index 4e20c046a..0f36aece3 100755 --- a/plugins/proxy/internal-functions +++ b/plugins/proxy/internal-functions @@ -75,36 +75,3 @@ fn-proxy-enabled() { fi echo "$PROXY_ENABLED" } - -proxy_help_content_func() { - declare desc="return proxy plugin help content" - cat <, [DEPRECATED] Show proxy settings for app - proxy:disable , Disable proxy for app - proxy:enable , Enable proxy for app - proxy:ports , List proxy port mappings for app - proxy:ports-add [::...], Add proxy port mappings to an app - proxy:ports-clear , Clear all proxy port mappings for an app - proxy:ports-remove [|::...], Remove specific proxy port mappings from an app - proxy:ports-set [::...], Set proxy port mappings for an app - proxy:report [] [], Displays a proxy report for one or more apps - proxy:set , Set proxy type for app -help_content -} - -cmd-proxy-help() { - if [[ $1 == "proxy:help" ]]; then - echo -e 'Usage: dokku proxy[:COMMAND]' - echo '' - echo 'Manage the proxy used by dokku on a per app.' - echo '' - echo 'Additional commands:' - proxy_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - proxy_help_content_func - else - cat <, List processes running in app container(s) - ps:inspect , Displays a sanitized version of docker inspect for an app - ps:scale = [=...], Get/Set how many instances of a given process to run - ps:start , Start app container(s) - ps:startall, Starts all apps via command line - ps:stop , Stop app container(s) - ps:stopall, Stop all app container(s) - ps:rebuild , Rebuild an app from source - ps:rebuildall, Rebuild all apps from source - ps:report [] [], Displays a process report for one or more apps - ps:restart , Restart app container(s) - ps:restartall, Restart all deployed app containers - ps:restore, Start previously running apps e.g. after reboot - ps:restart-policy , Shows the restart-policy for an app - ps:set-restart-policy , Sets app restart-policy -help_content - } - - if [[ $1 == "ps:help" ]]; then - echo -e 'Usage: dokku ps[:COMMAND]' - echo '' - echo 'List running processes in container, and restart app.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + cmd-ps-help "$@" ;; *) diff --git a/plugins/ps/help-functions b/plugins/ps/help-functions new file mode 100755 index 000000000..72ab28103 --- /dev/null +++ b/plugins/ps/help-functions @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-ps-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="ps" + local plugin_description="Manage container processes" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, List processes running in app container(s) + ps:inspect , Displays a sanitized version of docker inspect for an app + ps:scale = [=...], Get/Set how many instances of a given process to run + ps:start , Start app container(s) + ps:startall, Starts all apps via command line + ps:stop , Stop app container(s) + ps:stopall, Stop all app container(s) + ps:rebuild , Rebuild an app from source + ps:rebuildall, Rebuild all apps from source + ps:report [] [], Displays a process report for one or more apps + ps:restart , Restart app container(s) + ps:restartall, Restart all deployed app containers + ps:restore, Start previously running apps e.g. after reboot + ps:restart-policy , Shows the restart-policy for an app + ps:set-restart-policy , Sets app restart-policy +help_content +} diff --git a/plugins/repo/src/commands/commands.go b/plugins/repo/src/commands/commands.go index 03213873f..e7aae8f06 100644 --- a/plugins/repo/src/commands/commands.go +++ b/plugins/repo/src/commands/commands.go @@ -14,7 +14,7 @@ import ( const ( helpHeader = `Usage: dokku repo[:COMMAND] -Runs commands that interact with the app's repo +Manage the app's repo Additional commands:` @@ -40,7 +40,7 @@ func main() { if err == nil && strings.Contains(string(output), "--all") { fmt.Println(helpContent) } else { - fmt.Print("\n repo, Runs commands that interact with the app's repo\n") + fmt.Print("\n repo, Manage the app's repo\n") } default: dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT")) diff --git a/plugins/resource/src/commands/commands.go b/plugins/resource/src/commands/commands.go index a998d631d..46cbd806b 100644 --- a/plugins/resource/src/commands/commands.go +++ b/plugins/resource/src/commands/commands.go @@ -14,7 +14,7 @@ import ( const ( helpHeader = `Usage: dokku resource[:COMMAND] -Manages resource settings for an app +Manage resource settings for an app Additional commands:` @@ -43,7 +43,7 @@ func main() { if err == nil && strings.Contains(string(output), "--all") { fmt.Println(helpContent) } else { - fmt.Print("\n resource, Manages resource settings for an app\n") + fmt.Print("\n resource, Manage resource settings for an app\n") } default: dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT")) diff --git a/plugins/scheduler-docker-local/commands b/plugins/scheduler-docker-local/commands index 564163c53..7d260eb13 100755 --- a/plugins/scheduler-docker-local/commands +++ b/plugins/scheduler-docker-local/commands @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/scheduler-docker-local/help-functions" case "$1" in help | scheduler-docker-local:help) diff --git a/plugins/scheduler-docker-local/help-functions b/plugins/scheduler-docker-local/help-functions new file mode 100755 index 000000000..cdfa2d3ba --- /dev/null +++ b/plugins/scheduler-docker-local/help-functions @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-scheduler-docker-local-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="scheduler-docker-local" + local plugin_description="Manage the docker-local scheduler integration for an app" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <] [], Displays a scheduler-docker-local report for one or more apps + scheduler-docker-local:set (), Set or clear a scheduler-docker-local property for an app +help_content +} diff --git a/plugins/scheduler-docker-local/internal-functions b/plugins/scheduler-docker-local/internal-functions index 955f9b5df..0e2dc161b 100755 --- a/plugins/scheduler-docker-local/internal-functions +++ b/plugins/scheduler-docker-local/internal-functions @@ -65,32 +65,6 @@ cmd-scheduler-docker-local-report-single() { fi } -scheduler_docker_local_help_content_func() { - declare desc="return scheduler-docker-local plugin help content" - cat <] [], Displays a scheduler-docker-local report for one or more apps - scheduler-docker-local:set (), Set or clear a scheduler-docker-local property for an app -help_content -} - -cmd-scheduler-docker-local-help() { - if [[ $1 == "scheduler-docker-local:help" ]]; then - echo -e 'Usage: dokku scheduler-docker-local[:COMMAND]' - echo '' - echo 'Manages the scheduler-docker-local integration for an app.' - echo '' - echo 'Additional commands:' - scheduler_docker_local_help_content_func | sort | column -c2 -t -s, - echo '' - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - scheduler_docker_local_help_content_func - else - cat < [/path/to/key], Add a new public key by pipe or path + ssh-keys:remove , Remove SSH public key by name +help_content +} diff --git a/plugins/ssh-keys/internal-functions b/plugins/ssh-keys/internal-functions index c00fec062..09793be6f 100755 --- a/plugins/ssh-keys/internal-functions +++ b/plugins/ssh-keys/internal-functions @@ -2,33 +2,6 @@ set -eo pipefail [[ $DOKKU_TRACE ]] && set -x -ssh_keys_help_content_func() { - declare desc="return ssh-keys plugin help content" - cat < [/path/to/key], Add a new public key by pipe or path - ssh-keys:remove , Remove SSH public key by name -help_content -} - -cmd-ssh-keys-help() { - if [[ $1 == "ssh-keys:help" ]]; then - echo -e 'Usage: dokku ssh-keys[:COMMAND]' - echo '' - echo 'Manage public ssh keys that are allowed to connect to Dokku' - echo '' - echo 'Additional commands:' - ssh_keys_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - ssh_keys_help_content_func - else - cat <, List bind mounts for app's container(s) (host:container) + storage:mount , Create a new bind mount + storage:report [] [], Displays a checks report for one or more apps + storage:unmount , Remove an existing bind mount +help_content +} diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions index 6366b8f80..efa35d4b7 100755 --- a/plugins/storage/internal-functions +++ b/plugins/storage/internal-functions @@ -75,33 +75,6 @@ fn-storage-bind-mounts() { fi } -storage_help_content_func() { - declare desc="return storage plugin help content" - cat <, List bind mounts for app's container(s) (host:container) - storage:mount , Create a new bind mount - storage:report [] [], Displays a checks report for one or more apps - storage:unmount , Remove an existing bind mount -help_content -} - -cmd-storage-help() { - if [[ $1 == "storage:help" ]]; then - echo -e 'Usage: dokku storage[:COMMAND]' - echo '' - echo 'Mount local volume / directories inside containers.' - echo '' - echo 'Additional commands:' - storage_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - storage_help_content_func - else - cat <, List all app image tags - tags:create , Add tag to latest running app image - tags:deploy , Deploy tagged app image - tags:destroy , Remove app image tag -help_content - } - - if [[ $1 == "tags:help" ]]; then - echo -e 'Usage: dokku tags[:COMMAND]' - echo '' - echo 'Manage docker image tags.' - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + cmd-tags-help "$@" ;; *) diff --git a/plugins/tags/help-functions b/plugins/tags/help-functions new file mode 100755 index 000000000..dbb013ecf --- /dev/null +++ b/plugins/tags/help-functions @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-tags-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="tags" + local plugin_description="Manage docker image tags" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, List all app image tags + tags:create , Add tag to latest running app image + tags:deploy , Deploy tagged app image + tags:destroy , Remove app image tag +help_content +} diff --git a/plugins/tar/commands b/plugins/tar/commands index a7df11a82..7ae2dcc7a 100755 --- a/plugins/tar/commands +++ b/plugins/tar/commands @@ -1,12 +1,12 @@ #!/usr/bin/env bash [[ " help tar:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" -source "$PLUGIN_AVAILABLE_PATH/tar/internal-functions" +source "$PLUGIN_AVAILABLE_PATH/tar/help-functions" set -eo pipefail [[ $DOKKU_TRACE ]] && set -x case "$1" in help | tar:help) - cmd-tar-help "$1" + cmd-tar-help "$@" ;; *) diff --git a/plugins/tar/help-functions b/plugins/tar/help-functions new file mode 100755 index 000000000..7418c7a33 --- /dev/null +++ b/plugins/tar/help-functions @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -eo pipefail +[[ $DOKKU_TRACE ]] && set -x + +cmd-tar-help() { + declare desc="help command" + declare CMD="$1" + local plugin_name="tar" + local plugin_description="Manage app deploys via tar" + + if [[ "$CMD" == "$plugin_name:help" ]]; then + echo -e "Usage: dokku $plugin_name[:COMMAND]" + echo '' + echo "$plugin_description" + echo '' + echo 'Additional commands:' + fn-help-content | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + fn-help-content + else + cat <, Reads an tarball containing the app from stdin + tar:from , Loads an app tarball from url +help_content +} diff --git a/plugins/tar/internal-functions b/plugins/tar/internal-functions deleted file mode 100755 index 05648d755..000000000 --- a/plugins/tar/internal-functions +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -[[ $DOKKU_TRACE ]] && set -x - -tar_help_content_func() { - declare desc="return tar plugin help content" - cat <, Reads an tarball containing the app from stdin - tar:from , Loads an app tarball from url -help_content -} - -cmd-tar-help() { - if [[ $1 == "tar:help" ]]; then - echo -e 'Usage: dokku tar[:COMMAND]' - echo '' - echo 'An alternative to using git, apps are loaded via tarballs instead.' - echo '' - echo 'Additional commands:' - tar_help_content_func | sort | column -c2 -t -s, - elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then - tar_help_content_func - else - cat <