Skip to content

Add command and function introspection helpers to lib_std.sh #52

@codeforester

Description

@codeforester

Context

lib_std.sh already has fatal assertion helpers such as assert_command_exists, but callers sometimes need non-fatal command lookup or function availability checks for library/plugin-style preconditions.

Scope

Add Base-native command/function introspection helpers to lib_std.sh. Do not copy external implementations.

Acceptance Criteria

  • Add a non-fatal command path helper using a caller-provided result variable.
  • Add assert_function_exists for required Bash function checks.
  • Function checks use Bash-native function introspection such as declare -F.
  • Helpers preserve stdout unless a result output is intentionally requested through a variable.
  • Invalid result variable names fail clearly.
  • Public API and behavior are documented in lib/bash/std/README.md.
  • BATS coverage verifies commands, builtins or PATH commands as appropriate, existing functions, missing functions, and invalid result names.

Validation

  • Focused stdlib BATS coverage.
  • ./tests/validate.sh
  • `git diff --check

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or product improvement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions