Commit 35bdd17
docs: add bash array pattern for variadic args (#480)
## Summary
Documents how to properly convert variadic args (`var=#true`) to bash
arrays using the pattern:
```bash
eval "arr=($usage_var)"
```
This handles arguments with spaces correctly.
## Example
```bash
# Given: usage_files="arg1 'arg with space' arg3"
# Convert to bash array:
eval "files=($usage_files)"
# Now use as array:
for f in "${files[@]}"; do
echo "Processing: $f"
done
```
This addresses the common issue where users struggle to handle variadic
args with spaces in bash scripts.
Related: #189
🤖 Generated with [Claude Code](https://claude.ai/code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Documentation-only change; no runtime behavior is modified. Low risk
aside from potentially encouraging unsafe `eval` usage if misapplied.
>
> **Overview**
> Adds a new **“Using Variadic Args in Bash”** section to
`docs/spec/reference/arg.md` describing how `var=#true` values are
exposed via `usage_<name>` and providing a Bash snippet (`eval
"files=($usage_files)"`) to safely iterate/pass variadic args that may
contain spaces.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d23303c. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent 16f3858 commit 35bdd17
1 file changed
+25
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
16 | 40 | | |
| 41 | + | |
17 | 42 | | |
18 | 43 | | |
19 | 44 | | |
| |||
0 commit comments