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

Clap does not emit help-message on no-args #108

Closed
falkecarlsen opened this issue Mar 4, 2021 · 1 comment
Closed

Clap does not emit help-message on no-args #108

falkecarlsen opened this issue Mar 4, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@falkecarlsen
Copy link
Member

Using https://docs.rs/clap/2.33.3/clap/struct.App.html#method.print_help is not a viable route as App is consumed upon using get_matches, making it difficult to call print_help after using the result of get_matches to check if subcommands exist.

Could be solved by using the setting AppSettings::ArgRequiredElseHelp (https://docs.rs/clap/2.31.1/clap/enum.AppSettings.html#variant.ArgRequiredElseHelp), however there's issues with subcommands counting as arguments and if any default values are set (e.g. log-level), this effectively negates this setting.

This is a low value fix that seems difficult to implement. Found during #102.

@falkecarlsen falkecarlsen added the bug Something isn't working label Mar 4, 2021
@NicEastvillage
Copy link
Contributor

Resolved in #224. The setting we needed was called AppSettings::SubcommandRequiredElseHelp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants