From 4930003008d6f259d543b70fb64adf30217eb8f8 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 12 Mar 2017 21:29:01 -0600 Subject: [PATCH] feat: create repo:default alias for repo:help --- plugins/repo/commands | 20 ++------------------ plugins/repo/internal-functions | 27 +++++++++++++++++++++++++++ plugins/repo/subcommands/default | 5 +++++ 3 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 plugins/repo/internal-functions create mode 100755 plugins/repo/subcommands/default diff --git a/plugins/repo/commands b/plugins/repo/commands index 816768bf3..c261c436b 100755 --- a/plugins/repo/commands +++ b/plugins/repo/commands @@ -1,27 +1,11 @@ #!/usr/bin/env bash [[ " help repo:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT" +source "$PLUGIN_AVAILABLE_PATH/repo/internal-functions" set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in help | repo:help) - help_content_func () { - declare desc="return repo plugin help content" - cat<, Runs 'git gc --aggressive' against the application's repo - repo:purge-cache , Deletes the contents of the build cache stored in the repository -help_content - } - - if [[ $1 = "repo:help" ]] ; then - echo -e 'Usage: dokku repo[:COMMAND]' - echo '' - echo "Runs commands that interact with the app's repo" - echo '' - echo 'Additional commands:' - help_content_func | sort | column -c2 -t -s, - else - help_content_func - fi + repo_help_cmd "$@" ;; *) diff --git a/plugins/repo/internal-functions b/plugins/repo/internal-functions new file mode 100644 index 000000000..f58becc18 --- /dev/null +++ b/plugins/repo/internal-functions @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x + +repo_help_content_func () { + declare desc="return repo plugin help content" + cat<, Runs 'git gc --aggressive' against the application's repo + repo:purge-cache , Deletes the contents of the build cache stored in the repository +help_content +} + +repo_help_cmd() { + if [[ $1 = "repo:help" ]] ; then + echo -e 'Usage: dokku repo[:COMMAND]' + echo '' + echo "Runs commands that interact with the app's repo" + echo '' + echo 'Additional commands:' + repo_help_content_func | sort | column -c2 -t -s, + elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then + repo_help_content_func + else + cat<