refactor: move apps:help to internal-functions
This commit is contained in:
1 parent
9614f7dca2
commit
cd3e637387
3 files changed
+40
-31
No files matched your search
+2
-30
@@ -1,39 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
[[ " help apps:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||||
|
source "$PLUGIN_AVAILABLE_PATH/apps/internal-functions"
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
help | apps:help)
|
help | apps:help)
|
||||||
help_content_func () {
|
apps_help_cmd "$@"
|
||||||
declare desc="return apps plugin help content"
|
|
||||||
cat<<help_content
|
|
||||||
apps, Alias for apps:list (Deprecated)
|
|
||||||
apps:clone <old-app> <new-app>, Clones an app
|
|
||||||
apps:create <app>, Create a new app
|
|
||||||
apps:destroy <app>, Permanently destroy an app
|
|
||||||
apps:list, List your apps
|
|
||||||
apps:rename <old-app> <new-app>, Rename an app
|
|
||||||
apps:report [<app>] [<flag>], Display report about an app
|
|
||||||
help_content
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $1 = "apps:help" ]] ; then
|
|
||||||
echo -e 'Usage: dokku apps[:COMMAND]'
|
|
||||||
echo ''
|
|
||||||
echo 'List your apps.'
|
|
||||||
echo ''
|
|
||||||
echo 'Example:'
|
|
||||||
echo ''
|
|
||||||
echo '$ dokku apps'
|
|
||||||
echo '=====> My Apps'
|
|
||||||
echo 'example'
|
|
||||||
echo 'example2'
|
|
||||||
echo ''
|
|
||||||
echo 'Additional commands:'
|
|
||||||
help_content_func | sort | column -c2 -t -s,
|
|
||||||
else
|
|
||||||
help_content_func
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -2,6 +2,43 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
|
apps_help_content_func() {
|
||||||
|
declare desc="return apps plugin help content"
|
||||||
|
cat<<help_content
|
||||||
|
apps, [DEPRECATED] Alias for apps:list
|
||||||
|
apps:clone <old-app> <new-app>, Clones an app
|
||||||
|
apps:create <app>, Create a new app
|
||||||
|
apps:destroy <app>, Permanently destroy an app
|
||||||
|
apps:list, List your apps
|
||||||
|
apps:rename <old-app> <new-app>, Rename an app
|
||||||
|
apps:report [<app>] [<flag>], Display report about an app
|
||||||
|
help_content
|
||||||
|
}
|
||||||
|
|
||||||
|
apps_help_cmd() {
|
||||||
|
if [[ $1 = "apps:help" ]] ; then
|
||||||
|
echo -e 'Usage: dokku apps[:COMMAND]'
|
||||||
|
echo ''
|
||||||
|
echo 'Manage Dokku apps'
|
||||||
|
echo ''
|
||||||
|
echo 'Example:'
|
||||||
|
echo ''
|
||||||
|
echo '$ dokku apps'
|
||||||
|
echo '=====> My Apps'
|
||||||
|
echo 'example'
|
||||||
|
echo 'example2'
|
||||||
|
echo ''
|
||||||
|
echo 'Additional commands:'
|
||||||
|
apps_help_content_func | sort | column -c2 -t -s,
|
||||||
|
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
|
||||||
|
apps_help_content_func
|
||||||
|
else
|
||||||
|
cat<<help_desc
|
||||||
|
apps, Manage Dokku apps
|
||||||
|
help_desc
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
apps_list_cmd() {
|
apps_list_cmd() {
|
||||||
declare desc="lists all apps"
|
declare desc="lists all apps"
|
||||||
local cmd="apps"
|
local cmd="apps"
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ report_single_app() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apps_report_cmd() {
|
apps_report_cmd() {
|
||||||
declare desc="shows reports for an app"
|
declare desc="displays the app report for one or more apps"
|
||||||
local cmd="apps:report"
|
local cmd="apps:report"
|
||||||
local INSTALLED_APPS=$(dokku_apps)
|
local INSTALLED_APPS=$(dokku_apps)
|
||||||
local APP
|
local APP
|
||||||
|
|||||||
Reference in new issue
Block a user