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
Document external subcommands #3887
Comments
Unless you are disabling it, this still leaves |
just two cents from someone who's been working on something similar w/ external subcommands, I think a more reasonable approach API might be something like specifically, would also make it clear that edit: this approach would also solve #3880 |
The If I had to consider an ideal API for my usecase, I think it would be a way to specify a list of named external subcommands with a description of what they do, which is used as documentation on the toplevel, but then also informs clap that these are not going to want their own subcommand docs. The concrete effect this would have on |
I believe with #4187 it should now work to define subcommands and then capture all their values with |
Discussed in #3863
Originally posted by cd-work June 22, 2022
I'd like to write an external subcommand that accepts any parameter and forwards it, however it should also still be documented as subcommand.
I think this is probably a pretty common scenario, since you usually have some way to know which external subcommands are available even if you do not know their exact parameters. I do not want to allow just any subcommand, I have a list which I want to accept with generic parameters, everything else should still cause a failure.
I've tried using
ignore_errors(true)
, but that only seems to work globally and not on the subcommands themselves. Otherwise it could be used to just accept parameters.I've also used various combinations of allowing hyphen values and multiple values, but none of them seem to allow for the first argument to have two hyphens.
I only care about the subcommands documentation and description on the toplevel, since
bin subcommand --help
should already be forwarded to the subcommand and not handled by clap. This is also a scenario where built-in subcommands and flags exist already, so it's not only external subcommands I'm worried about.The text was updated successfully, but these errors were encountered: