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

fix(parser): Disambiguate whether built-in subcommands are escaped (unstable) #3703

Merged
merged 4 commits into from May 6, 2022

Conversation

epage
Copy link
Member

@epage epage commented May 6, 2022

When you escape subcommand (cmd -- subcmd), it always becomes an external subcommand even if a built-in one matches. There wasn't a way to detect this. Now, a user can check matches.is_present("") and that will signal its an external subcommand.

With this change, we've updated clap_derive to correctly populate external subcommands rather than the built-in version (and error if it didn't work out).

With all of that done, we can now remove the hack where we disable unknown argument assertions since users can correctly guard to prevent hitting it.

Because of compatibility concerns, this is all gated behind unstable-v4.

Fixes #3263

@epage epage merged commit fbb01d8 into clap-rs:master May 6, 2022
19 of 20 checks passed
@epage epage deleted the external branch May 6, 2022
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