Skip to content
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

Allow to mark arguments as to be ignored by suggestions. #5097

Closed
wants to merge 1 commit into from

Commits on Aug 28, 2023

  1. 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.
    Carreau committed Aug 28, 2023
    Configuration menu
    Copy the full SHA
    79864a8 View commit details
    Browse the repository at this point in the history