Tags: curatorium/bash-args
Tags
Sanitize nameref targets in args:opt/arg/varg/sub for hyphenated long…
… flags
args:flag already strips non-alphanumeric chars when building the nameref
target (so `--dry-run` can write to a caller-declared `dry_run` variable);
the other four functions did not. Calling `args:opt gh-source ""` would
fail with "invalid variable name for name reference" because bash variable
names can't contain hyphens, even though the long-flag scan pattern (which
preserves the hyphen) was correct.
Apply the same `${1//[^_0-9a-zA-Z]/_}` substitution across args:opt,
args:arg, args:varg, args:sub. Existing alphanumeric-only call sites are
unaffected (substitution is a no-op).
Two regression tests added (smoke:opt:hyphenated-long-name,
smoke:flag:hyphenated-long-name).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>