Skip to content

Fix missing optional arguments to win over values#155

Open
svoop wants to merge 1 commit intomainfrom
126-optional-opts-and-args
Open

Fix missing optional arguments to win over values#155
svoop wants to merge 1 commit intomainfrom
126-optional-opts-and-args

Conversation

@svoop
Copy link

@svoop svoop commented Jan 27, 2026

See #126 (comment)

Optional arguments (either implic or with explicit required: false) should be accepted when missing even if a values list does not include nil as a value – at least as per the principle of least surprise.

argument :required_arg, required: true, values: %w(one two)
argument :optional_arg, required: false, values: %w(one two)
cmd             # ERROR
cmd one         # OKAY
cmd three       # ERROR 
cmd one two     # OKAY
cmd one three   # ERROR

Not sure how best to spec this, hope it's okay to having added a vacuum subcommand to the db example.

/cc @gustavothecoder

@svoop svoop requested a review from timriley January 27, 2026 18:45
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.

1 participant