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

Enhancement: Handle syntax --[no-]cheese #2213

Open
fodil-a-mindflow opened this issue Jun 24, 2024 · 1 comment
Open

Enhancement: Handle syntax --[no-]cheese #2213

fodil-a-mindflow opened this issue Jun 24, 2024 · 1 comment

Comments

@fodil-a-mindflow
Copy link

Hello,

I hope you're doing well! I just wanted to say that your library is fantastic. While working with it, I discovered that to create flags for both yes and no, I need to declare each one separately.

I was wondering if you might consider an enhancement to the syntax, such as using [no-], to automatically generate both commands with true/false values. 😃

I'd be happy to contribute by submitting a PR for this feature if you're interested.

Have a great day!

@shadowspawn
Copy link
Collaborator

Not sure quite what you have in mind. Would you see one option or two in the help?

For some historical background, the original support for a negated option (e.g. --no-cheese) was for a stand-alone option and it did not work as part of a yes/no pair of options.

Support was added in #795 to allow a yes/no pair of options to work nicely together, and extended in in #987 and #1652 for defaults and presets.

Now that we have a solid implementation, I am reluctant to add support for a single-option supporting both yes/no as an alternative way of implementing the same behaviour (#1355) without some compelling need or a lot of up-votes.

If you were thinking of an author shortcut for creating the pair of options with a single call, I think you could implement that with an override to Command.

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

No branches or pull requests

2 participants