-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
generate_help
for a subcommand doesn't include the bin_name
#4685
Comments
You need to call |
To clarify, let mut cmd = Args::command();
cmd.build();
... We call build for the individual subcommand but you need to call build on the top-level command. We should be at least calling this out in the docs. We might want to change the implicit build to an assert to make this more obvious. |
I'm assuming that has resolved things for you. If not, let us know! |
Yes, thanks! This indeed worked :) I think ideally such methods would only be callable after invoking |
That is being tracked in #2911 which is complicated by the lazy building that clap does. |
The command requires a call to the `build` function. See clap-rs/clap#4685
* Add cache subcommand documentation * Add completions subcommand docs * Update gen-docs xtask * Update command pages * Update stacklet xref * Add conditions hint * Update Cockpit start page * Generate usage docs into antora partial * Re-add correct long help texts The command requires a call to the `build` function. See clap-rs/clap#4685
When running the above code with
cargo run help subcommand
, you get the following output:Notice how the
Usage:
line generated bygenerate_help
does not include the name (bin_name
) of the main command (main-command
).I would expect the output of
generate_help
to match the output of the actual help clap prints when parsing arguments.Versions
Debug Output
Debug output
The text was updated successfully, but these errors were encountered: