forked from clap-rs/clap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(did-you-mean): mark args to be ignored
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.
- Loading branch information
Showing
4 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters