-
-
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
clap suggests hidden subcommands in "similar subcommand" error hints #4853
Comments
Fix in #4852 |
Can you give your use case as to why you expect hidden subcommands to be not suggested? The exact semantics of This latter case sounds similar to suggestions in errors which runs counter to this issue / #4852 which is why this merits further discussion. |
so the tool I am working on has commands that is not intended to be run manually, at all. they are only intended to be invoked internally by the tool itself. i am ok with only suggesting them when the user do intend to use them, but i don't see how you can reliably detect user intentions. i found this to be a problem because clap suggested things like |
maybe there can be two levels of hidden-ness? like, hidden and hidden hidden |
With #5075, we have |
As pointed out in clap-rs#4853, it might be useful to mark arguments to not be considered by the suggestions feature. In particular with the introduction of UnknownArgumentValueParser in clap-rs#5075, one might want explicitly handle some common confusion (say handle `--silent` and print `tip: did you mean --quiet`), but not have those in the suggestion engine. I'm guessing one might want to have an `arg` be visible but not in suggestion for deprecated flags as well. I'm trying to do so by adding a `.didyoumena(false)`, that will mark the argument as to not be considered by suggestion. There is also some mention of completion of hidden command in clap-rs#4853, that might be relevant as well. -- I'm not too familiar with clap internals, and fairly new to rust, but in particular : - I've tried to implement that only for args - I guess we will need to extend to subcommands if this goes further - I'm not happy with the setting negations nor the naming `didyoumean`/`ExcludeDidYouMean` - I'm not super happy about the iteration over MKeyMap keys and items.
As pointed out in clap-rs#4853, it might be useful to mark arguments to not be considered by the suggestions feature. In particular with the introduction of UnknownArgumentValueParser in clap-rs#5075, one might want explicitly handle some common confusion (say handle `--silent` and print `tip: did you mean --quiet`), but not have those in the suggestion engine. I'm guessing one might want to have an `arg` be visible but not in suggestion for deprecated flags as well. I'm trying to do so by adding a `.didyoumena(false)`, that will mark the argument as to not be considered by suggestion. There is also some mention of completion of hidden command in clap-rs#4853, that might be relevant as well. -- I'm not too familiar with clap internals, and fairly new to rust, but in particular : - I've tried to implement that only for args - I guess we will need to extend to subcommands if this goes further - I'm not happy with the setting negations nor the naming `didyoumean`/`ExcludeDidYouMean` - I'm not super happy about the iteration over MKeyMap keys and items.
I was curious and tried to find a way to do so in #5097. It adds Anyway just a suggestion instead of fighting for wether or not |
There was more discussion in rust-lang/cargo#11702 and it is unclear what we want the behavior to be in that case.
Except this shifts the discussion to whether this part of the API pulls enough weight to justify itself. We've been focusing recently on shrinking clap, in binary size, in compile time, and in API size. The bigger the API is, the harder it is to find anything, making it less likely people will use any of the features in the API, lowering the value gained by having each piece of the API. |
Please complete the following tasks
Rust Version
irrelevant
Clap Version
master
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo run -- su
Actual Behaviour
Expected Behaviour
nothing is suggested.
Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered: