fix: ensure we can call the report subcommand without an app while specifying flags

Closes #2628
This commit is contained in:
Jose Diaz-Gonzalez
2017-03-16 02:33:51 -06:00
parent 4de0e693ca
commit 97e35e796c
8 changed files with 142 additions and 55 deletions

View File

@@ -74,8 +74,9 @@ fn-ssl-verified() {
echo "$SSL_SELF_SIGNED"
}
certs_report_single_app() {
local APP="$1"; local APP_DIR="$DOKKU_ROOT/$APP"; local INFO_FLAG="$2"
report_single_app() {
declare APP="$1" INFO_FLAG="$2"
local APP_DIR="$DOKKU_ROOT/$APP"
if [[ "$INFO_FLAG" == "true" ]]; then
INFO_FLAG=""
fi
@@ -122,14 +123,24 @@ certs_report_single_app() {
certs_report_cmd() {
declare desc="displays an ssl report for one or more apps"
local cmd="certs:report"
local INSTALLED_APPS=$(dokku_apps); local APP
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ -z $2 ]]; then
for APP in $INSTALLED_APPS; do
certs_report_single_app "$APP" "true"
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi
if [[ -z "$APP" ]]; then
for app in $INSTALLED_APPS; do
report_single_app "$app" "$INFO_FLAG" | tee || true
done
else
certs_report_single_app "$2" "$3"
report_single_app "$APP" "$INFO_FLAG"
fi
}