Added nginx default help function

This commit is contained in:
Omar Shehata
2016-11-28 03:03:30 +00:00
parent 74db5b9d3b
commit 810ba72879
3 changed files with 35 additions and 15 deletions

View File

@@ -1,26 +1,14 @@
#!/usr/bin/env bash
[[ " help nginx:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
case "$1" in
help | nginx:help)
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
}
if [[ $1 = "nginx:help" ]] ; then
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_formatted
else
help_content_func
fi

View File

@@ -6,6 +6,25 @@ 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

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
nginx_main_cmd() {
declare desc="display nginx plugin help content"
local cmd="nginx"
help_formatted
}
nginx_main_cmd "$@"