Skip to content

Add Base-native argument and option parsing helpers #69

@codeforester

Description

@codeforester

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or product improvement

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions