Skip to content

Tags: curatorium/bash-args

Tags

v1.0.0-alpha.3

Toggle v1.0.0-alpha.3's commit message

Verified

This commit was signed with the committer’s verified signature.
mihai-stancu Mihai Stancu
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>

v1.0.0-alpha.2

Toggle v1.0.0-alpha.2's commit message

Verified

This commit was signed with the committer’s verified signature.
mihai-stancu Mihai Stancu
[bugfix] Switched to pre-increment for ((++hits))

Post-increment returns 0 when hits=0
set -e treats it as falsy and triggers exit

v1.0.0-alpha

Toggle v1.0.0-alpha's commit message

Verified

This commit was signed with the committer’s verified signature.
mihai-stancu Mihai Stancu
bugfix: circular ref. when caller passes a nameref named like the loc…

…al var holding the ref