Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teach Option to accept only explicit values #1230

Closed
wants to merge 2 commits into from

Conversation

jpassaro
Copy link

Add a new attribute/argument explicit_only to Option class. When set
to true, this option will cause Options with nargs=1 to only accept
input that is explicitly associated to it.

This makes the following valid:

command
command --option
command --option=value

This addresses #549 and #764.

Prior to now, the logic for detecting an option value based on the
remaining arguments on the command line has been handled inline in two
different places. This refactor brings the two extremely similar
procedures into one place, both for simplicity and to ease future
changes.
Add a new attribute/argument `explicit_only` to `Option` class. When set
to true, this option will cause Options with nargs=1 to only accept
input that is explicitly associated to it.

This makes the following valid:

    command
    command --option
    command --option=value

This addresses pallets#549 and pallets#764.
@davidism
Copy link
Member

davidism commented Aug 8, 2020

Thanks for working on this. While it's an interesting solution to the issue, I don't think we should be adjusting how the basic syntax works for individual options. Addressing this with #1618 instead.

@davidism davidism closed this Aug 8, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants