refactor: unify command declaration across codebase
This commit is contained in:
@@ -6,9 +6,10 @@ set -eo pipefail
|
||||
|
||||
cmd-proxy-report() {
|
||||
declare desc="displays a proxy report for one or more apps"
|
||||
local cmd="proxy:report"
|
||||
declare cmd="proxy:report"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
local INSTALLED_APPS=$(dokku_apps)
|
||||
local APP="$2" INFO_FLAG="$3"
|
||||
local APP="$1" INFO_FLAG="$2"
|
||||
|
||||
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
|
||||
INFO_FLAG="$APP"
|
||||
|
||||
@@ -6,11 +6,13 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-default() {
|
||||
declare desc="displays app proxy implementation via command line"
|
||||
local cmd="proxy"
|
||||
declare cmd="proxy"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
local APPS=$(dokku_apps)
|
||||
if [[ -n "$1" ]]; then
|
||||
local APPS="$1"
|
||||
if [[ -n "$APP" ]]; then
|
||||
local APPS="$APP"
|
||||
fi
|
||||
|
||||
dokku_log_warn "Deprecated: Please use proxy:report"
|
||||
|
||||
@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-disable() {
|
||||
declare desc="disable proxy for app via command line"
|
||||
local cmd="proxy:disable"
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local APP="$1"
|
||||
declare cmd="proxy:disable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ "$(is_app_proxy_enabled "$APP")" == "true" ]]; then
|
||||
|
||||
@@ -7,9 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-enable() {
|
||||
declare desc="enable proxy for app via command line"
|
||||
local cmd="proxy:enable"
|
||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local APP="$1"
|
||||
declare cmd="proxy:enable"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ "$(is_app_proxy_enabled "$APP")" == "false" ]]; then
|
||||
|
||||
@@ -7,10 +7,11 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
cmd-proxy-ports() {
|
||||
declare desc="cmd wrapper to list proxy port mappings for an app"
|
||||
local cmd="proxy:ports"
|
||||
local APP="$2"
|
||||
verify_app_name "$APP"
|
||||
declare cmd="proxy:ports"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
verify_app_name "$APP"
|
||||
list_app_proxy_ports "$APP"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-ports-add() {
|
||||
declare desc="add proxy port mappings to an app"
|
||||
local cmd="proxy:add"
|
||||
local APP="$2"
|
||||
declare cmd="proxy:add"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
verify_app_name "$APP"
|
||||
shift 2
|
||||
shift 1
|
||||
|
||||
add_proxy_ports "$APP" "$@"
|
||||
plugn trigger post-proxy-ports-update "$APP" "add"
|
||||
|
||||
@@ -6,10 +6,11 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
cmd-proxy-ports-clear() {
|
||||
declare desc="clear all proxy port mappings for an app"
|
||||
local cmd="proxy:clear"
|
||||
local APP="$2"
|
||||
verify_app_name "$APP"
|
||||
declare cmd="proxy:clear"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
verify_app_name "$APP"
|
||||
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_PROXY_PORT_MAP
|
||||
plugn trigger post-proxy-ports-update "$APP" "clear"
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-ports-remove() {
|
||||
declare desc="remove specific proxy port mappings from an app"
|
||||
local cmd="proxy:ports-remove"
|
||||
local APP="$2"
|
||||
declare cmd="proxy:ports-remove"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
verify_app_name "$APP"
|
||||
shift 2
|
||||
shift 1
|
||||
|
||||
local INPUT_PORTS="$*"
|
||||
if [[ -z "$INPUT_PORTS" ]]; then
|
||||
|
||||
@@ -6,10 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/proxy/functions"
|
||||
|
||||
cmd-proxy-ports-set() {
|
||||
declare desc="set proxy port mappings for an app"
|
||||
local cmd="proxy:set"
|
||||
local APP="$2"
|
||||
declare cmd="proxy:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1"
|
||||
|
||||
verify_app_name "$APP"
|
||||
shift 2
|
||||
shift 1
|
||||
|
||||
set_proxy_ports "$APP" "$@"
|
||||
plugn trigger post-proxy-ports-update "$APP" "set"
|
||||
|
||||
@@ -6,12 +6,12 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||
|
||||
cmd-proxy-set() {
|
||||
declare desc="enable proxy for app via command line"
|
||||
local cmd="proxy:set"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
declare cmd="proxy:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" PROXY_TYPE="$2"
|
||||
|
||||
local APP="$2"
|
||||
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
verify_app_name "$APP"
|
||||
local PROXY_TYPE="$3"
|
||||
|
||||
if [[ -n "$PROXY_TYPE" ]]; then
|
||||
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_PROXY_TYPE="$PROXY_TYPE"
|
||||
|
||||
Reference in New Issue
Block a user