Skip to content

reject missing choice value - #432

Draft
aouxwoux wants to merge 1 commit into
p-ranav:masterfrom
aouxwoux:agent/reject-missing-choice-value
Draft

reject missing choice value#432
aouxwoux wants to merge 1 commit into
p-ranav:masterfrom
aouxwoux:agent/reject-missing-choice-value

Conversation

@aouxwoux

@aouxwoux aouxwoux commented Aug 2, 2026

Copy link
Copy Markdown

what changed

make an option with choices(...).nargs(1) reject the option when it appears without a value, and add a regression test.

why

when choices are configured, consume uses the number of matching values as the effective maximum. zero matching values was then treated as a zero-argument option, which bypassed the configured minimum and allowed --color to succeed with an empty value.

this keeps the zero-argument path for options whose configured minimum is zero, while allowing the normal minimum-argument validation to reject missing values.

checks

  • git diff --check passes.
  • local cmake configuration could not run because nmake and a c++ compiler are not installed in this checkout.

fixes #431

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When an optional option with choices is used with nargs(1), if the option appears last, an empty argument is accepted when it shouldn't.

1 participant