refactor: standardize help generation

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-10 00:37:00 -05:00
parent be5ea845fc
commit ef7894fdfa
67 changed files with 816 additions and 603 deletions

View File

@@ -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 <<help_content
cleanup [<app>], Cleans up exited/dead Docker containers and removes dangling images
run [--env KEY=VALUE] <app> <cmd>, Run a command in a new container using the current application image
url <app>, Show the first URL for an application (compatibility)
urls <app>, 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 "$@"
;;
*)

View File

@@ -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 <<help_content
cleanup [<app>], Cleans up exited/dead Docker containers and removes dangling images
run [--env KEY=VALUE] <app> <cmd>, Run a command in a new container using the current application image
url <app>, Show the first URL for an application (compatibility)
urls <app>, Show all URLs for an application
version , Print dokku's version
help , Print the list of commands
help_content
}

View File

@@ -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 <<help_content
events [-t], Show the last events (-t follows)
events:list, List logged events
events:on, Enable events logger
events:off, Disable events logger
help_content
}
if [[ $1 == "events:help" ]]; then
echo 'Usage: dokku events:COMMAND [-t]'
echo ''
echo 'Interact with Dokku event logger.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
cmd-events-help "$@"
;;
*)

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-events-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="events"
local plugin_description="Interact with Dokku event logger"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
events [-t], Show the last events (-t follows)
events:list, List logged events
events:on, Enable events logger
events:off, Disable events logger
help_content
}

View File

@@ -14,6 +14,9 @@ cmd-events-list() {
dokku_col_log_info2_quiet "Events currently logged"
for hook in $logged; do
if [[ "$hook" == "help-functions" ]]; then
continue
fi
dokku_col_log_msg "$hook"
done
else

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/apps/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

42
plugins/apps/help-functions Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-apps-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="apps"
local plugin_description="Manage apps"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
apps, [DEPRECATED] Alias for apps:list
apps:clone <old-app> <new-app>, Clones an app
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:exists <app>, Checks if an app exists
apps:list, List your apps
apps:lock <app>, Locks an app for deployment
apps:locked <app>, Checks if an app is locked for deployment
apps:rename <old-app> <new-app>, Rename an app
apps:report [<app>] [<flag>], Display report about an app
apps:unlock <app>, Unlocks an app for deployment
help_content
}

View File

@@ -78,47 +78,6 @@ cmd-apps-report-single() {
fi
}
apps_help_content_func() {
declare desc="return apps plugin help content"
cat <<help_content
apps, [DEPRECATED] Alias for apps:list
apps:clone <old-app> <new-app>, Clones an app
apps:create <app>, Create a new app
apps:destroy <app>, Permanently destroy an app
apps:exists <app>, Checks if an app exists
apps:list, List your apps
apps:lock <app>, Locks an app for deployment
apps:locked <app>, Checks if an app is locked for deployment
apps:rename <old-app> <new-app>, Rename an app
apps:report [<app>] [<flag>], Display report about an app
apps:unlock <app>, 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 <<help_desc
apps, Manage Dokku apps
help_desc
fi
}
cmd-apps-list() {
declare desc="lists all apps"
local cmd="apps"

View File

@@ -14,7 +14,7 @@ import (
const (
helpHeader = `Usage: dokku buildpacks[:COMMAND]
Manages buildpacks settings for an app
Manage buildpacks settings for an app
Additional commands:`
@@ -44,7 +44,7 @@ func main() {
if err == nil && strings.Contains(string(output), "--all") {
fmt.Println(helpContent)
} else {
fmt.Print("\n buildpacks, Manages buildpack settings for an app\n")
fmt.Print("\n buildpacks, Manage buildpack settings for an app\n")
}
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/certs/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

41
plugins/certs/help-functions Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-certs-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="certs"
local plugin_description="Manage SSL (TLS) certs"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
certs <app>, [DEPRECATED] Alternative for certs:report
certs:add <app> 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 <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
certs:info <app>, [DEPRECATED] Alternative for certs:report
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
certs:remove <app>, Remove an SSL Endpoint from an app
certs:report [<app>] [<flag>], Displays an ssl report for one or more apps
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
certs:update <app> CRT KEY, Update an SSL Endpoint on an app. Can also import from a tarball on stdin
help_content
}

View File

@@ -71,39 +71,6 @@ cmd-certs-report-single() {
fi
}
certs_help_content_func() {
declare desc="return certs plugin help content"
cat <<help_content
certs <app>, [DEPRECATED] Alternative for certs:report
certs:add <app> 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 <app> DOMAIN, Generate a key and certificate signing request (and self-signed certificate)
certs:info <app>, [DEPRECATED] Alternative for certs:report
certs:key <app> CRT KEY [KEY ...], [NOT IMPLEMENTED] Print the correct key for the given certificate
certs:remove <app>, Remove an SSL Endpoint from an app
certs:report [<app>] [<flag>], Displays an ssl report for one or more apps
certs:rollback <app>, [NOT IMPLEMENTED] Rollback an SSL Endpoint for an app
certs:update <app> 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 <<help_desc
certs, Manage Dokku apps SSL (TLS) certs
help_desc
fi
}
cmd-certs-info() {
# This is here because it's used in both the info and the default
declare desc="prints SSL certificate info for app"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help checks:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/checks/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/checks/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

37
plugins/checks/help-functions Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-checks-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="checks"
local plugin_description="Manage zero-downtime settings"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
checks <app>, [DEPRECATED] Alternative for checks:report
checks:disable <app> [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 <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
checks:report [<app>] [<flag>], Displays a checks report for one or more apps
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
checks:skip <app> [process-type(s)], Skip zero-downtime checks for all processes (or comma-separated process-type list)
help_content
}

View File

@@ -65,35 +65,6 @@ cmd-checks-report-single() {
fi
}
checks_help_content_func() {
declare desc="return checks plugin help content"
cat <<help_content
checks <app>, [DEPRECATED] Alternative for checks:report
checks:disable <app> [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 <app> [process-type(s)], Enable zero-downtime deployment for all processes (or comma-separated process-type list)
checks:report [<app>] [<flag>], Displays a checks report for one or more apps
checks:run <app> [process-type(s)], Runs zero-downtime checks for all processes (or comma-separated process-type list)
checks:skip <app> [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 <<help_desc
checks, Manage zero-downtime settings
help_desc
fi
}
fn-checks-disabled-list() {
declare APP="$1"

View File

@@ -13,9 +13,9 @@ import (
)
const (
helpHeader = `Usage: dokku config [<app>|--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"))

View File

@@ -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 <<help_content
docker-options <app> [phase(s)], [DEPRECATED] Alternative for docker-options:report
docker-options:add <app> <phase(s)> OPTION, Add Docker option to app for phase (comma separated phase list)
docker-options:clear <app> [phase(s)], Clear a docker options from application with an optional phase (comma separated phase list)
docker-options:remove <app> <phase(s)> OPTION, Remove Docker option from app for phase (comma separated phase list)
docker-options:report [<app>] [<flag>], 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 <<help_desc
docker-options, Pass options to Docker the various stages of an app
help_desc
fi
}
case "$1" in
help | docker-options:help)
cmd-docker-options-help "$@"

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-docker-options-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="docker-options"
local plugin_description="Manage docker options 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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
docker-options <app> [phase(s)], [DEPRECATED] Alternative for docker-options:report
docker-options:add <app> <phase(s)> OPTION, Add Docker option to app for phase (comma separated phase list)
docker-options:clear <app> [phase(s)], Clear a docker options from application with an optional phase (comma separated phase list)
docker-options:remove <app> <phase(s)> OPTION, Remove Docker option from app for phase (comma separated phase list)
docker-options:report [<app>] [<flag>], Displays a docker options report for one or more apps
help_content
}

View File

@@ -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

43
plugins/domains/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
domains [<app>], [DEPRECATED] Alternative for domains:report
domains:add <app> <domain> [<domain> ...], Add domains to app
domains:add-global <domain> [<domain> ...], Add global domain names
domains:clear <app>, Clear all domains for app
domains:clear-global, Clear global domain names
domains:disable <app>, Disable VHOST support
domains:enable <app>, Enable VHOST support
domains:remove <app> <domain> [<domain> ...], Remove domains from app
domains:remove-global <domain> [<domain> ...], Remove global domain names
domains:report [<app>|--global] [<flag>], Displays a domains report for one or more apps
domains:set <app> <domain> [<domain> ...], Set domains for app
domains:set-global <domain> [<domain> ...], Set global domain names
help_content
}

View File

@@ -84,41 +84,6 @@ cmd-domains-report-single() {
fi
}
domains_help_content_func() {
declare desc="return domains plugin help content"
cat <<help_content
domains [<app>], [DEPRECATED] Alternative for domains:report
domains:add <app> <domain> [<domain> ...], Add domains to app
domains:add-global <domain> [<domain> ...], Add global domain names
domains:clear <app>, Clear all domains for app
domains:clear-global, Clear global domain names
domains:disable <app>, Disable VHOST support
domains:enable <app>, Enable VHOST support
domains:remove <app> <domain> [<domain> ...], Remove domains from app
domains:remove-global <domain> [<domain> ...], Remove global domain names
domains:report [<app>|--global] [<flag>], Displays a domains report for one or more apps
domains:set <app> <domain> [<domain> ...], Set domains for app
domains:set-global <domain> [<domain> ...], 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 <<help_desc
domains, Manage vhost domains used by the Dokku proxy
help_desc
fi
}
fn-domains-app-enabled() {
declare APP="$1"
local DOMAINS_APP_ENABLED=false

View File

@@ -1,27 +1,12 @@
#!/usr/bin/env bash
[[ " help enter:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/enter/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | enter:help)
help_content_func() {
declare desc="return enter plugin help content"
cat <<help_content
enter <app> [<container-type> || --container-id <container-id>], Connect to a specific app container
help_content
}
if [[ $1 == "enter:help" ]]; then
echo -e 'Usage: dokku enter <app>'
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 "$@"
;;
*)

32
plugins/enter/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
enter <app> [<container-type> || --container-id <container-id>], Connect to a specific app container
help_content
}

View File

@@ -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)

34
plugins/git/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
git:initialize <app>, Initialize a git repository for an app
git:report [<app>] [<flag>], Displays a git report for one or more apps
git:set <app> <property> (<value>), Set or clear a git property for an app
help_content
}

View File

@@ -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 <<help_content
git:initialize <app>, Initialize a git repository for an app
git:report [<app>] [<flag>], Displays a git report for one or more apps
git:set <app> <property> (<value>), 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 <<help_desc
git, Manages the git integration for an app
help_desc
fi
}

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/git/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/git/help-functions"
cmd-git-help "git:help"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help logs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/logs/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/logs/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

33
plugins/logs/help-functions Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-logs-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="logs"
local plugin_description="Manage log 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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
logs <app> [-h] [-t] [-n num] [-q] [-p process], Display recent log output
logs:failed <app>, Show the last logs for an application
help_content
}

View File

@@ -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 <<help_content
logs <app> [-h] [-t] [-n num] [-q] [-p process], Display recent log output
logs:failed <app>, 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 <<help_desc
logs, Output app logs
help_desc
fi
}

View File

@@ -14,16 +14,16 @@ import (
const (
helpHeader = `Usage: dokku network[:COMMAND]
Manages network settings for an app
Manage network settings for an app
Additional commands:`
helpContent = `
network:create <network>, Creates an attachable docker network
network:destroy <network>, Destroys a docker network
network:exists <network>, Checks if a docker network exists
network:info <network>, Outputs information about a docker network
network:list, Lists all docker networks
network:create <network>, Creates an attachable docker network
network:destroy <network>, Destroys a docker network
network:exists <network>, Checks if a docker network exists
network:info <network>, Outputs information about a docker network
network:list, Lists all docker networks
network:report [<app>] [<flag>], Displays a network report for one or more apps
network:rebuild <app>, 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"))

View File

@@ -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

View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
nginx:build-config <app>, (Re)builds nginx config for given app
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
nginx:report [<app>] [<flag>], Displays an nginx report for one or more apps
nginx:set <app> <property> (<value>), Set or clear an nginx property for an app
nginx:show-conf <app>, Display app nginx config
nginx:validate [<app>] [--clean], Validates and optionally cleans up invalid nginx configurations
help_content
}

View File

@@ -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 <<help_content
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
nginx:build-config <app>, (Re)builds nginx config for given app
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
nginx:report [<app>] [<flag>], Displays an nginx report for one or more apps
nginx:set <app> <property> (<value>), Set or clear an nginx property for an app
nginx:show-conf <app>, Display app nginx config
nginx:validate [<app>] [--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 <<help_desc
nginx, Interact with Dokku's Nginx proxy
help_desc
fi
}
nginx_clear_config() {
declare desc="Remove the nginx conf file"
declare APP="$1"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/help-functions"
cmd-nginx-vhosts-help "nginx:help"

View File

@@ -1,34 +1,12 @@
#!/usr/bin/env bash
[[ " help plugin:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/plugin/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | plugin:help)
help_content_func() {
declare desc="return plugin plugin help content"
cat <<help_content
plugin:disable <name>, Disable an installed plugin (third-party only)
plugin:enable <name>, 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 <args...>, Trigger an arbitrary plugin hook
plugin:uninstall <name>, 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 "$@"
;;
*)

39
plugins/plugin/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
plugin:disable <name>, Disable an installed plugin (third-party only)
plugin:enable <name>, 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 <args...>, Trigger an arbitrary plugin hook
plugin:uninstall <name>, 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
}

View File

@@ -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

41
plugins/proxy/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
proxy <app>, [DEPRECATED] Show proxy settings for app
proxy:disable <app>, Disable proxy for app
proxy:enable <app>, Enable proxy for app
proxy:ports <app>, List proxy port mappings for app
proxy:ports-add <app> [<scheme>:<host-port>:<container-port>...], Add proxy port mappings to an app
proxy:ports-clear <app>, Clear all proxy port mappings for an app
proxy:ports-remove <app> [<host-port>|<scheme>:<host-port>:<container-port>...], Remove specific proxy port mappings from an app
proxy:ports-set <app> [<scheme>:<host-port>:<container-port>...], Set proxy port mappings for an app
proxy:report [<app>] [<flag>], Displays a proxy report for one or more apps
proxy:set <app> <proxy-type>, Set proxy type for app
help_content
}

View File

@@ -75,36 +75,3 @@ fn-proxy-enabled() {
fi
echo "$PROXY_ENABLED"
}
proxy_help_content_func() {
declare desc="return proxy plugin help content"
cat <<help_content
proxy <app>, [DEPRECATED] Show proxy settings for app
proxy:disable <app>, Disable proxy for app
proxy:enable <app>, Enable proxy for app
proxy:ports <app>, List proxy port mappings for app
proxy:ports-add <app> [<scheme>:<host-port>:<container-port>...], Add proxy port mappings to an app
proxy:ports-clear <app>, Clear all proxy port mappings for an app
proxy:ports-remove <app> [<host-port>|<scheme>:<host-port>:<container-port>...], Remove specific proxy port mappings from an app
proxy:ports-set <app> [<scheme>:<host-port>:<container-port>...], Set proxy port mappings for an app
proxy:report [<app>] [<flag>], Displays a proxy report for one or more apps
proxy:set <app> <proxy-type>, 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 <<help_desc
proxy, Manage the proxy used by dokku on a per app
help_desc
fi
}

View File

@@ -1,41 +1,12 @@
#!/usr/bin/env bash
[[ " help ps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/ps/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | ps:help)
help_content_func() {
declare desc="return ps plugin help content"
cat <<help_content
ps <app>, List processes running in app container(s)
ps:inspect <app>, Displays a sanitized version of docker inspect for an app
ps:scale <app> <proc>=<count> [<proc>=<count>...], Get/Set how many instances of a given process to run
ps:start <app>, Start app container(s)
ps:startall, Starts all apps via command line
ps:stop <app>, Stop app container(s)
ps:stopall, Stop all app container(s)
ps:rebuild <app>, Rebuild an app from source
ps:rebuildall, Rebuild all apps from source
ps:report [<app>] [<flag>], Displays a process report for one or more apps
ps:restart <app>, Restart app container(s)
ps:restartall, Restart all deployed app containers
ps:restore, Start previously running apps e.g. after reboot
ps:restart-policy <app>, Shows the restart-policy for an app
ps:set-restart-policy <app> <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 "$@"
;;
*)

46
plugins/ps/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
ps <app>, List processes running in app container(s)
ps:inspect <app>, Displays a sanitized version of docker inspect for an app
ps:scale <app> <proc>=<count> [<proc>=<count>...], Get/Set how many instances of a given process to run
ps:start <app>, Start app container(s)
ps:startall, Starts all apps via command line
ps:stop <app>, Stop app container(s)
ps:stopall, Stop all app container(s)
ps:rebuild <app>, Rebuild an app from source
ps:rebuildall, Rebuild all apps from source
ps:report [<app>] [<flag>], Displays a process report for one or more apps
ps:restart <app>, Restart app container(s)
ps:restartall, Restart all deployed app containers
ps:restore, Start previously running apps e.g. after reboot
ps:restart-policy <app>, Shows the restart-policy for an app
ps:set-restart-policy <app> <policy>, Sets app restart-policy
help_content
}

View File

@@ -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"))

View File

@@ -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"))

View File

@@ -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)

View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
scheduler-docker-local:report [<app>] [<flag>], Displays a scheduler-docker-local report for one or more apps
scheduler-docker-local:set <app> <property> (<value>), Set or clear a scheduler-docker-local property for an app
help_content
}

View File

@@ -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 <<help_content
scheduler-docker-local:report [<app>] [<flag>], Displays a scheduler-docker-local report for one or more apps
scheduler-docker-local:set <app> <property> (<value>), 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 <<help_desc
scheduler-docker-local, Manages the scheduler-docker-local integration for an app
help_desc
fi
}
fn-scheduler-docker-local-retire-container() {
declare APP="$1" CID="$2" DEAD_TIME="$3"
local STATE

View File

@@ -1,6 +1,6 @@
#!/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"
cmd-scheduler-docker-local-help "scheduler-docker-local:help"

View File

@@ -1,29 +1,12 @@
#!/usr/bin/env bash
[[ " help shell:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/shell/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | shell:help)
help_content_func() {
declare desc="return shell plugin help content"
cat <<help_content
shell, Spawn dokku shell
help_content
}
if [[ $1 == "shell:help" ]]; then
echo -e 'Usage: dokku shell'
echo ''
echo 'Dokku shell is an interactive dokku prompt.'
echo ''
echo 'Note: See dokku enter:help for shell access to containers.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
cmd-shell-help "$@"
;;
*)

32
plugins/shell/help-functions Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-shell-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="shell"
local plugin_description="Interactive dokku prompt"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
shell, Spawn dokku shell
help_content
}

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help ssh-keys:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

34
plugins/ssh-keys/help-functions Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-ssh-keys-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="ssh-keys"
local plugin_description="Manage public ssh keys used for deployment"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
ssh-keys:list, List of all authorized dokku public ssh keys
ssh-keys:add <name> [/path/to/key], Add a new public key by pipe or path
ssh-keys:remove <name>, Remove SSH public key by name
help_content
}

View File

@@ -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 <<help_content
ssh-keys:list, List of all authorized dokku public ssh keys
ssh-keys:add <name> [/path/to/key], Add a new public key by pipe or path
ssh-keys:remove <name>, 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 <<help_desc
ssh-keys, Manage public ssh keys that are allowed to connect to Dokku
help_desc
fi
}
cmd-list-ssh-keys() {
declare desc="List ssh key hashes"
local cmd="ssh-keys:list"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/help-functions"
cmd-ssh-keys-help "ssh-keys:help"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " storage:help help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/storage/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/storage/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

35
plugins/storage/help-functions Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-storage-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="storage"
local plugin_description="Manage mounted volumes"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
storage:list <app>, List bind mounts for app's container(s) (host:container)
storage:mount <app> <host-dir:container-dir>, Create a new bind mount
storage:report [<app>] [<flag>], Displays a checks report for one or more apps
storage:unmount <app> <host-dir:container-dir>, Remove an existing bind mount
help_content
}

View File

@@ -75,33 +75,6 @@ fn-storage-bind-mounts() {
fi
}
storage_help_content_func() {
declare desc="return storage plugin help content"
cat <<help_content
storage:list <app>, List bind mounts for app's container(s) (host:container)
storage:mount <app> <host-dir:container-dir>, Create a new bind mount
storage:report [<app>] [<flag>], Displays a checks report for one or more apps
storage:unmount <app> <host-dir:container-dir>, 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 <<help_desc
storage, Mount local volume / directories inside containers
help_desc
fi
}
cmd-storage-list() {
declare desc="List all bound mounts"
local cmd="storage:list"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/storage/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/storage/help-functions"
cmd-storage-help "storage:help"

View File

@@ -1,30 +1,12 @@
#!/usr/bin/env bash
[[ " help tags:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/tags/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | tags:help)
help_content_func() {
declare desc="return tags plugin help content"
cat <<help_content
tags <app>, List all app image tags
tags:create <app> <tag>, Add tag to latest running app image
tags:deploy <app> <tag>, Deploy tagged app image
tags:destroy <app> <tag>, 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 "$@"
;;
*)

35
plugins/tags/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
tags <app>, List all app image tags
tags:create <app> <tag>, Add tag to latest running app image
tags:deploy <app> <tag>, Deploy tagged app image
tags:destroy <app> <tag>, Remove app image tag
help_content
}

View File

@@ -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 "$@"
;;
*)

33
plugins/tar/help-functions Executable file
View File

@@ -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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, Loads an app tarball from url
help_content
}

View File

@@ -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 <<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, 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 <<help_desc
tar, Deploy applications via tarball instead of git
help_desc
fi
}

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/tar/help-functions"
cmd-tar-help "tar:help"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
[[ " help trace:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/trace/internal-functions"
source "$PLUGIN_AVAILABLE_PATH/trace/help-functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x

34
plugins/trace/help-functions Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
cmd-trace-help() {
declare desc="help command"
declare CMD="$1"
local plugin_name="trace"
local plugin_description="Manage trace mode"
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 <<help_desc
$plugin_name, $plugin_description
help_desc
fi
}
fn-help-content() {
declare desc="return help content"
cat <<help_content
trace, [DEPRECATED] Enables/Disables trace mode
trace:on, Enable trace mode
trace:off, Disable trace mode
help_content
}

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
trace_help_content_func() {
declare desc="return trace plugin help content"
cat <<help_content
trace, [DEPRECATED] Enables/Disables trace mode
trace:on, Enable trace mode
trace:off, Disable trace mode
help_content
}
cmd-trace-help() {
if [[ $1 == "trace:help" ]]; then
echo -e 'Usage: dokku trace[:COMMAND]'
echo ''
echo 'Manage trace mode'
echo ''
echo 'Additional commands:'
trace_help_content_func | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
trace_help_content_func
else
cat <<help_desc
trace, Manage trace mode
help_desc
fi
}