Merge pull request #2650 from dokku/2627-bare-help-output

Fix help output for nginx and ssh-keys
This commit is contained in:
Jose Diaz-Gonzalez
2017-03-13 10:36:25 -06:00
committed by GitHub
23 changed files with 105 additions and 60 deletions

View File

@@ -3,11 +3,11 @@
> New as of 0.4.0
```
plugin # Print active plugins
plugin:disable <name> # Disable an installed plugin (third-party only)
plugin:enable <name> # Enable a previously disabled plugin
plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]] # Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones)
plugin:install-dependencies [--core] # Run install-dependencies trigger for active plugins (or only core ones)
plugin:list # Print active plugins
plugin:uninstall <name> # Uninstall a plugin (third-party only)
plugin:update [name [committish]] # Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins
```

View File

@@ -30,7 +30,7 @@ hello_main_cmd() {
set -- $cmd $@
##
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2";
@@ -58,7 +58,7 @@ hello_world_cmd() {
set -- $cmd $@
##
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2"
local APP="$2";

2
dokku
View File

@@ -56,7 +56,7 @@ if [[ $(id -un) != "dokku" ]] && [[ ! $1 =~ plugin:* ]] && [[ ! $1 == "ssh-keys:
exit $?
fi
if [[ $(id -un) != "root" && $1 =~ ^plugin:.* ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then
if [[ $(id -un) != "root" && $1 =~ ^plugin:.* && $1 != "plugin:help" && $1 != "plugin:list" ]] || [[ $(id -un) != "root" && $1 == "ssh-keys:add" ]]; then
dokku_log_fail "This command must be run as root"
fi

View File

@@ -530,7 +530,7 @@ dokku_deploy_cmd() {
source "$PLUGIN_AVAILABLE_PATH/config/functions"
source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to deploy"
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$1"; local IMAGE_TAG="$2"; local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
verify_app_name "$APP"
plugn trigger pre-deploy "$APP" "$IMAGE_TAG"

View File

@@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
nginx_logs_cmd() {
declare desc="display app nginx logs from command line"
local cmd="$1"
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
nginx_logs "$@"
}

View File

@@ -7,7 +7,7 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions"
nginx_build_config_cmd() {
declare desc="build nginx config to proxy app containers from command line"
local cmd="nginx:build-config"
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
nginx_build_config "$2"
}

View File

@@ -2,4 +2,4 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/internal-functions"
nginx_vhosts_help_cmd "$@"
nginx_vhosts_help_cmd "nginx:help"

View File

@@ -7,7 +7,7 @@ case "$1" in
help_content_func () {
declare desc="return plugin plugin help content"
cat<<help_content
plugin, Print active plugins
plugin:list, Print active plugins
plugin:install [--core|git-url [--committish tag|branch|commit|--name custom-plugin-name]], Optionally download git-url (with custom tag/committish) & run install trigger for active plugins (or only core ones)
plugin:install-dependencies [--core], Run install-dependencies trigger for active plugins (or only core ones)
plugin:update [name [committish]], Optionally update named plugin from git (with custom tag/committish) & run update trigger for active plugins

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
plugin_list_cmd() {
declare desc="lists all plugins"
local cmd="plugin"
plugn version
plugn list
}

View File

@@ -1,11 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/internal-functions"
plugin_main_cmd() {
declare desc="shows details about locally installed plugins"
local cmd="plugin"
plugn version
plugn list
}
plugin_main_cmd "$@"
dokku_log_warn "Deprecated: Please use plugin:list"
plugin_list_cmd "$@"

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/plugin/internal-functions"
plugin_list_cmd "$@"

View File

@@ -5,6 +5,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
ps_main_cmd() {
declare desc="shows running processes in all running app containers"
local cmd="ps"
dokku_log_warn "Deprecated: Please use ps:report"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"; verify_app_name "$APP"

View File

@@ -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<<help_content
repo:gc <app>, Runs 'git gc --aggressive' against the application's repo
repo:purge-cache <app>, 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 "$@"
;;
*)

View File

@@ -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<<help_content
repo:gc <app>, Runs 'git gc --aggressive' against the application's repo
repo:purge-cache <app>, 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<<help_desc
repo, Runs commands that interact with the app's repo
help_desc
fi
}

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/repo/internal-functions"
repo_help_cmd "repo:help"

View File

@@ -2,8 +2,8 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
ssh_keys_help_content_func() {
declare desc="return ssh-keys plugin help content"
cat<<help_content
declare desc="return ssh-keys plugin help content"
cat<<help_content
ssh-keys:list, List of all authorized dokku public ssh keys
ssh-keys:add <name> [/path/to/key], Add a new public key by pipe or path
ssh-keys:remove <name>, Remove SSH public key by name

View File

@@ -2,4 +2,4 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/ssh-keys/internal-functions"
ssh_keys_help_cmd "$@"
ssh_keys_help_cmd "ssh-keys:help"

View File

@@ -1,12 +1,13 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
storage_list_cmd() {
declare desc="List all bound mounts"
local cmd="storage:list"
local passed_phases="deploy"
[[ ! $2 ]] && dokku_log_fail "storage:list requires an app to list."
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
verify_app_name "$2" && local APP="$2"
echo "$APP volume bind-mounts:"
get_bind_mounts "$(get_phase_file_path "$passed_phases")"

3
plugins/storage/subcommands/default Normal file → Executable file
View File

@@ -2,11 +2,12 @@
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
storage_main_cmd() {
declare desc="an alias for storage:list"
local cmd="storage"
dokku_log_warn "Deprecated: Please use storage:list"
storage_list_cmd "$@"
}

View File

@@ -1,8 +1,6 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/storage/functions"
source "$PLUGIN_CORE_AVAILABLE_PATH/docker-options/functions"
storage_list_cmd "$@"

View File

@@ -1,27 +1,11 @@
#!/usr/bin/env bash
[[ " help tar:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
source "$PLUGIN_AVAILABLE_PATH/tar/internal-functions"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
case "$1" in
help | tar:help)
help_content_func () {
declare desc="return tar plugin help content"
cat<<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, Loads an app tarball from url
help_content
}
if [[ $1 = "tar:help" ]] ; then
echo -e 'Usage: dokku tar[:COMMAND]'
echo ''
echo 'An alternative to using git, apps are loaded via tarballs instead.'
echo ''
echo 'Additional commands:'
help_content_func | sort | column -c2 -t -s,
else
help_content_func
fi
tar_help_cmd "$1"
;;
*)

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
tar_help_content_func() {
declare desc="return tar plugin help content"
cat<<help_content
tar:in <app>, Reads an tarball containing the app from stdin
tar:from <app> <url>, Loads an app tarball from url
help_content
}
tar_help_cmd() {
if [[ $1 = "tar:help" ]] ; then
echo -e 'Usage: dokku tar[:COMMAND]'
echo ''
echo 'An alternative to using git, apps are loaded via tarballs instead.'
echo ''
echo 'Additional commands:'
tar_help_content_func | sort | column -c2 -t -s,
elif [[ $(ps -o command= $PPID) == *"--all"* ]]; then
tar_help_content_func
else
cat<<help_desc
tar, Deploy applications via tarball instead of git
help_desc
fi
}

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_AVAILABLE_PATH/tar/internal-functions"
tar_help_cmd "tar:help"