-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support excluding a subcommand from shell completion #1335
Comments
Ideally, we would want this to be configured while creating the generator, but there's a lot more generation related work we would want to look at first to see if the current code is viable for future or not. |
See also #3951 for native completion support |
Thanks to clap-rs/clap#4090 (comment) for the info on how to do that. Unfortunately, it still shows up in shell completions: - clap-rs/clap#1335 - clap-rs/clap#2541 (comment)
This issue has labels marking it as "easy" and "help wanted". But at the same time it sounds like there are open fundamental questions about whether you want it: e.g. from issue #2541 @pksunkara said Jun 17, 2021:
and then in Dec 10, 2021:
And earlier on this issue, also on Dec 10, 2021
So... which is it, is this "easy" and "help wanted", or is there in contrast actually need for design work and experiments and what not? In other words, if someone made a PR for this, would it actually have a chance of being merged? |
Its been a couple years and I unfortunately didn't take enough notes here. I think it'd be reasonable to emulate what we can from the proposal in #3951 would be reasonable. That basically means (1) don't suggest hidden items but (2) complete within them where we can. The part we likely can't emulate is "complete the hidden item if its the only choice left". |
For my specific use case it would be fine to have it fully excluded, without the need for (2). (however I wouldn't mind having (2)). The subcommand is |
Feature Request Summary
I would like to exclude some subcommands from the generated shell completion. For example, the command to generate those completions is usually only used during installation and shouldn't be suggested to the user. I've managed to hide the subcommand from the help text with
AppSettings::Hidden
, but it's still included in the shell completion.Expected Behavior Summary
foo <tab><tab>
All commands that are marked with
AppSettings::Hidden
are not suggestedActual Behavior Summary
foo <tab><tab>
All commands are suggested.
The text was updated successfully, but these errors were encountered: