Skip to content

Add list and array helper library #70

@codeforester

Description

@codeforester

Summary

Add a focused list/array helper library that follows Base's in-place/result-variable API style.

Rationale

aks/bash-lib has useful list and hash utility coverage. Base should borrow the idea for array ergonomics, but keep the initial scope narrow and aligned with the current string-library direction: no subshell-heavy output capture for mutations, validated variable names, and clear import guardrails.

Proposed Scope

  • Add a new guarded companion library, likely lib/bash/list/lib_list.sh.
  • Require lib_std.sh to be sourced first.
  • Provide a small initial API for array/list operations such as membership, append/prepend, remove, unique/dedupe, join/split interop, and length checks.
  • Use result-variable or in-place named-variable APIs for operations that need to modify caller state.
  • Add README coverage and examples.
  • Add BATS coverage for whitespace-preserving values, empty elements, invalid variable names, and repeated sourcing.

Acceptance Criteria

  • The library improves common Bash array handling without becoming a broad data-structure framework.
  • Mutating helpers avoid command-substitution/subshell patterns.
  • Public helpers validate variable-name inputs with assert_variable_name.
  • ./tests/validate.sh passes.

Notes

Concept source: comparison with aks/bash-lib list utilities; 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