From 900f9723e5bf3dc90b342afedac72d025ffbbe15 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 7 Apr 2026 20:32:12 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20address=20PR=20review=20=E2=80=94=20unkn?= =?UTF-8?q?own=20flag=20guard,=20local=20var=20scope,=20container=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reject unknown --flags with error instead of silently treating as commit SHA - Declare remote_hash as local to prevent stale values across loop iterations - Use associative array for container names (consistent with DEPLOY_HOST pattern) Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/deploy.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index a3ada84..509138f 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -56,6 +56,10 @@ while [[ $# -gt 0 ]]; do SYNC_TEMPLATES=true shift ;; + --*) + echo -e "${RED}Unknown option: $1${NC}" + usage + ;; *) COMMIT="$1" shift @@ -93,7 +97,7 @@ check_templates() { local changed=() local missing_remote=() while IFS= read -r line; do - local hash file + local hash file remote_hash hash=$(echo "$line" | awk '{print $1}') file=$(echo "$line" | awk '{print $2}') remote_hash=$(echo "$remote_hashes" | awk -v f="$file" '$2 == f {print $1}') @@ -131,14 +135,11 @@ check_templates() { check_templates # --- Cached image report --- +declare -A API_CONTAINER=([dev]="dev_pd_database" [prod]="pd_api") + report_cache() { local host="${DEPLOY_HOST[$ENV]}" - local container - if [[ "$ENV" == "dev" ]]; then - container="dev_pd_database" - else - container="pd_api" - fi + local container="${API_CONTAINER[$ENV]}" echo -e "${CYAN}Cached card images on ${host} (${container}):${NC}" ssh "$host" "