Commit 9a61fbb
refactor(content-guards): replace fragile bash expansion with explicit branching
The previous fix (PR #39, commit 2202144) used ${config_flag[@]+"${config_flag[@]}"} to work around
bash 3.2's unbound variable error with empty arrays. While functional, this expansion is:
- Hard to read and understand
- Easy to get wrong (even the commit message described it backwards)
- Fragile across bash versions
This change replaces the arcane parameter expansion with explicit conditional branching:
- Check array length with ${#config_flag[@]} (works correctly under set -u)
- Separate code paths for empty/non-empty arrays
- Clear, maintainable, and works on all bash versions including macOS bash 3.2
Verified with /bin/bash (bash 3.2) under set -euo pipefail with both code paths.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 2202144 commit 9a61fbb
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| |||
0 commit comments