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: Focus on ArgRequiredElseHelp instead of SubcommandRequiredElseHelp #3455

Closed
wants to merge 7 commits into from

Conversation

epage
Copy link
Member

@epage epage commented Feb 11, 2022

This simplifies the code now and opens the door for simplifying the code in the future since subcommand_required(true).arg_required_else_help(true) offers a better experience while not requiring we track required arguments with two different settings.

This does mean the derive has a different set of settings applied. This will break people making assumptions about what settings we apply.

Fixes #3280

Showing help on `$ cmd` makes sense but when an arg is present but not
subcommand, that suggests the user missed something, so we should show a
more specific error message.

Compatibility note: Settings we apply for subcommands have changed.

Fixes clap-rs#3280
With clap-rs#3280 resolved where we can use `SubcommandRequired |
ArgRequiredElseHelp`, this setting offers little value but requires we
track required subcommands with two different settings.  Deprecating as
the cost is not worth the benefit anymore.
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.

Derive should only show help when argc==1 rather than missing subcommand
1 participant