Skip to content

Reject option tokens as missing values in arg_parse #77

Description

@codeforester

Context

arg_parse currently accepts the next argument as the value for a value option unless the next argument is missing or exactly --. It does not check whether the next token is itself a registered option.

Failure Scenario

With specs such as output|value|--output and verbose|flag|--verbose, this call succeeds incorrectly:

arg_parse options positionals specs -- --output --verbose

The parser stores options[output]=--verbose and never sets the verbose flag.

Scope

  • When a value option consumes the following token, reject the value if it is a known option token.
  • Preserve legitimate option-like values that are not registered options, unless the existing API explicitly forbids them.
  • Add BATS coverage for a value option followed by a registered flag/value token.

Acceptance Criteria

  • --output --verbose returns usage status instead of consuming --verbose as the output value.
  • Unknown option-like strings used as values keep the current documented behavior.
  • ./tests/validate.sh passes.

Validation

  • ./tests/validate.sh

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions