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

clap_complete: fix support for two multi-length arguments in zsh #4612

Merged
merged 1 commit into from
Feb 23, 2023

Commits on Jan 10, 2023

  1. fix(complete): Handle multi-valued arguments

    zsh completions for commands that have multiple Vec arguments require
    special care.
    
    We can have two Vec args separated with a value terminator.
    We can also have two Vec args with no value terminators specified
    where the final arg uses 'raw' and thus requires '--' to be used.
    
    The 2nd of these scenarios requires special handling to avoid
    emitting a duplicate '*:arguments' completion entry.
    
    Currently, the zsh completions generate an error in this scenario:
    
        $ my-app <TAB>
        _arguments:...: doubled rest argument definition:
        *::second -- second set of of multi-length arguments:
    
    We already use the '-S' option when calling _arguments.
    This option makes it so that completion stops after '--' is encountered.
    This means that the handling for trailing 'raw' arguments does not need
    to specified.
    
    Special-case multi-valued arguments so that we can skip emitting
    the final multi-valued argument if a previous multi-valued argument
    has already been emitted.
    
    Closes clap-rs#3022
    Signed-off-by: David Aguilar <davvid@gmail.com>
    davvid committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    170bd59 View commit details
    Browse the repository at this point in the history