refactor: move certs:help into internal-functions
This commit is contained in:
1 parent
cb71d8a0be
commit
84fab30c09
2 files changed
+35
-30
No files matched your search
+2
-30
@@ -1,39 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
[[ " help certs:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/certs/internal-functions"
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
help | certs:help)
|
help | certs:help)
|
||||||
help_content_func () {
|
certs_help_cmd "$@"
|
||||||
declare desc="return certs plugin help content"
|
|
||||||
cat<<help_content
|
|
||||||
certs, [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
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $1 = "certs:help" ]] ; then
|
|
||||||
echo -e 'Usage: dokku certs:COMMAND'
|
|
||||||
echo ''
|
|
||||||
echo 'Manage Dokku apps SSL (TLS) certs.'
|
|
||||||
echo ''
|
|
||||||
echo 'Additional commands:'
|
|
||||||
help_content_func | sort | column -c2 -t -s,
|
|
||||||
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
|
||||||
help_content_func
|
|
||||||
else
|
|
||||||
cat<<help_desc
|
|
||||||
certs, Manage Dokku apps SSL (TLS) certs
|
|
||||||
help_desc
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -3,6 +3,39 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
source "$PLUGIN_AVAILABLE_PATH/certs/functions"
|
||||||
|
|
||||||
|
certs_help_content_func() {
|
||||||
|
declare desc="return certs plugin help content"
|
||||||
|
cat<<help_content
|
||||||
|
certs, [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
|
||||||
|
}
|
||||||
|
|
||||||
|
certs_help_cmd() {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
certs_info_cmd() {
|
certs_info_cmd() {
|
||||||
# This is here because it's used in both the info and the default
|
# This is here because it's used in both the info and the default
|
||||||
declare desc="prints SSL certificate info for app"
|
declare desc="prints SSL certificate info for app"
|
||||||
|
|||||||
Reference in new issue
Block a user