refactor: move nginx:help to internal-functions
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
|
||||
|
||||
case "$1" in
|
||||
help | nginx:help)
|
||||
|
||||
|
||||
if [[ $1 = "nginx:help" ]] ; then
|
||||
help_formatted
|
||||
else
|
||||
help_content_func
|
||||
fi
|
||||
;;
|
||||
nginx_vhosts_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
@@ -6,25 +6,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/domains/functions"
|
||||
source "$PLUGIN_AVAILABLE_PATH/ps/functions"
|
||||
|
||||
help_formatted (){
|
||||
echo -e 'Usage: dokku nginx[:COMMAND]'
|
||||
echo ''
|
||||
echo 'Interact with Dokku'"'"'s Nginx proxy.'
|
||||
echo ''
|
||||
echo 'Additional commands:'
|
||||
help_content_func | sort | column -c2 -t -s,
|
||||
}
|
||||
|
||||
help_content_func () {
|
||||
declare desc="return nginx plugin help content"
|
||||
cat<<help_content
|
||||
nginx, Interact with Dokku's Nginx proxy
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
help_content
|
||||
}
|
||||
|
||||
validate_nginx() {
|
||||
declare desc="validate entire nginx config"
|
||||
set +e
|
||||
|
||||
28
plugins/nginx-vhosts/internal-functions
Executable file
28
plugins/nginx-vhosts/internal-functions
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
nginx_vhosts_help_content_func() {
|
||||
declare desc="return nginx plugin help content"
|
||||
cat<<help_content
|
||||
nginx:build-config <app>, (Re)builds nginx config for given app
|
||||
nginx:access-logs <app> [-t], Show the nginx access logs for an application (-t follows)
|
||||
nginx:error-logs <app> [-t], Show the nginx error logs for an application (-t follows)
|
||||
help_content
|
||||
}
|
||||
|
||||
nginx_vhosts_help_cmd() {
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user