Collapse help into expandable command topics
This commit is contained in:
@@ -1,17 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
[[ " help help:help ls:help run:help trace:help url:help urls:help version:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help)
|
||||
cat<<EOF
|
||||
ls, Pretty listing of deployed applications and containers
|
||||
help|ls: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 help_content string"
|
||||
cat<<help_content
|
||||
ls , Pretty listing of deployed applications and containers
|
||||
run <app> <cmd>, Run a command in the environment of an application
|
||||
trace [on/off], Enable dokku tracing
|
||||
url <app>, Show the first URL for an application (compatibility)
|
||||
urls <app>, Show all URLs for an application
|
||||
version, Print dokku's version
|
||||
EOF
|
||||
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
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user