fix: preserve info flag in plugin reports with --global

The argument-handling block in each plugin's report command overwrote APP with --global before checking whether $1 actually held an info flag, so `dokku <plugin>:report --global --<plugin>-foo` always emitted the full report instead of the requested value. Reorder the conditionals across the sixteen plugins that share the pattern so the info-flag check runs first, and add a regression bats case for each one.
This commit is contained in:
Jose Diaz-Gonzalez
2026-04-30 21:05:46 -04:00
parent 53ef8c7780
commit e8d8b0683a
31 changed files with 278 additions and 50 deletions

View File

@@ -12,13 +12,15 @@ cmd-builder-dockerfile-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-builder-herokuish-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-builder-lambda-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-builder-nixpacks-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-builder-pack-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-builder-railpack-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -37,13 +37,15 @@ cmd-caddy-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,13 +12,15 @@ cmd-certs-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -13,13 +13,15 @@ cmd-checks-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -12,15 +12,15 @@ cmd-domains-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ "$APP" == "--global" ]]; then
:
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" != "--global" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -327,13 +327,15 @@ cmd-git-report() {
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -37,13 +37,15 @@ cmd-haproxy-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -15,13 +15,15 @@ cmd-nginx-report() {
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -37,13 +37,15 @@ cmd-openresty-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -13,13 +13,15 @@ cmd-scheduler-docker-local-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi

View File

@@ -37,13 +37,15 @@ cmd-traefik-report() {
set -- "${REPORT_ARGS[@]}"
declare APP="${1:-}" INFO_FLAG="${2:-}"
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
elif [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
fi
if [[ "$REPORT_IS_GLOBAL" == "true" ]]; then
APP="--global"
fi
if [[ -z "$APP" ]] && [[ -z "$INFO_FLAG" ]]; then
INFO_FLAG="true"
fi