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

Automate the generation of negation flags #234

Merged
merged 2 commits into from
Feb 15, 2022

Conversation

blyxxyz
Copy link
Collaborator

@blyxxyz blyxxyz commented Feb 15, 2022

clap 3 lets us do this.

The only observable difference is that --no-help and --no-version exist now. Those are a bit useless, but HTTPie also has them, so that's okay.

The only observable difference is that --no-help and --no-version
exist now. Those are a bit useless, but HTTPie also has them, so
that's okay.
Flags don't take an argument, options might.

In the long term we should look at custom subheadings and/or
clap_mangen.
Copy link
Owner

@ducaale ducaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I've never been more excited for a PR than this one!

Comment on lines +520 to +525
static ARG_STORAGE: OnceCell<Vec<String>> = OnceCell::new();
let arg_storage = ARG_STORAGE.get_or_init(|| {
opts.iter()
.map(|opt| format!("--no-{}", opt.get_long().expect("long option")))
.collect()
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to mention this workaround in clap-rs/clap#815

@ducaale ducaale merged commit d5ca750 into ducaale:develop Feb 15, 2022
@blyxxyz blyxxyz deleted the auto-negation-flags branch February 15, 2022 21:41
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.

None yet

2 participants