Summary
Add conservative argument and option parsing helpers for Base-style Bash scripts.
Rationale
External libraries such as srcshelton/stdlib.sh and aks/bash-lib show that argument parsing becomes valuable once shell helpers are reused across scripts. Base should provide a small, predictable API rather than pushing every consumer to hand-roll parsing.
Proposed Scope
- Decide whether this belongs in a new guarded companion library, likely
lib/bash/arg/lib_arg.sh, rather than expanding lib_std.sh.
- Require
lib_std.sh to be sourced first if a new companion library is added.
- Support common flag/value patterns used by Base scripts without introducing a large CLI framework.
- Prefer result-variable or in-place patterns where output must survive the current shell.
- Document intended usage and non-goals.
- Add BATS coverage for valid parsing, missing values, unknown options, repeated flags, and help/usage behavior if supported.
Acceptance Criteria
- Bash scripts can parse common options without ad hoc loops.
- The API follows Base naming, validation, import, and testing standards.
- No code is copied from external repositories.
./tests/validate.sh passes.
Notes
Concept sources: comparison with srcshelton/stdlib.sh parseargs and aks/bash-lib arg/option helpers; write fresh Base-style code.
Summary
Add conservative argument and option parsing helpers for Base-style Bash scripts.
Rationale
External libraries such as
srcshelton/stdlib.shandaks/bash-libshow that argument parsing becomes valuable once shell helpers are reused across scripts. Base should provide a small, predictable API rather than pushing every consumer to hand-roll parsing.Proposed Scope
lib/bash/arg/lib_arg.sh, rather than expandinglib_std.sh.lib_std.shto be sourced first if a new companion library is added.Acceptance Criteria
./tests/validate.shpasses.Notes
Concept sources: comparison with
srcshelton/stdlib.shparseargs andaks/bash-libarg/option helpers; write fresh Base-style code.