refactor: move domains:help to internal-functions

This commit is contained in:
Jose Diaz-Gonzalez
2017-02-20 22:50:07 -07:00
parent 48653e5663
commit 282979eef4
2 changed files with 37 additions and 26 deletions

View File

@@ -1,35 +1,11 @@
#!/usr/bin/env bash
[[ " help domains:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/domains/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | domains:help)
help_content_func () {
declare desc="return domains plugin help content"
cat<<help_content
domains [<app>], List domains
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: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:set <app> <domain> [<domain> ...], Set domains for app
domains:set-global <domain> [<domain> ...], Set global domain names
help_content
}
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:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
domains_help_cmd "$@"
;;
*)

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
domains_help_content_func () {
declare desc="return domains plugin help content"
cat<<help_content
domains [<app>], List domains
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: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:set <app> <domain> [<domain> ...], Set domains for app
domains:set-global <domain> [<domain> ...], Set global domain names
help_content
}
domains_help_cmd() {
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
}