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

fix(completion): emit value terminators on zsh #4624

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

davvid
Copy link
Contributor

@davvid davvid commented Jan 10, 2023

Subset of #4612

Expose get_value_terminator() for use by clap_complete.

Related-to: clap-rs#3022
Signed-off-by: David Aguilar <davvid@gmail.com>
Emit the user-defined value terminator into the zsh completion pattern
to avoid doubled rest-arguments definitions:

    $ my-app <TAB>
    _arguments:comparguments:325: doubled rest argument definition:
    *::second -- second set of of multi-length arguments:

clap-rs#3266 (comment)
noted that including the value terminator is one step towards a
robust solution for handling multiple multi-valued arguments.

This change does not yet handle automatically detecting when a value
terminator is needed, but it does add tests to ensure that
user-specified value terminators are used on zsh.

Related-to: clap-rs#3022
Signed-off-by: David Aguilar <davvid@gmail.com>
@epage epage merged commit b86c259 into clap-rs:master Jan 10, 2023
davvid added a commit to garden-rs/garden that referenced this pull request Jan 21, 2023
Related-to: #10
Related-to: clap-rs/clap#3022
Related-to: clap-rs/clap#4624
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit to garden-rs/garden that referenced this pull request Jan 21, 2023
Now that clap-rs/clap#4624 was merged we can use value_terminator to fix the
zsh completions for commands that use two consecutive multi-valued arguments.

A more complete solution may arrive in clap-rs/clap#4612 but until that is
merged we can use this solution for now. If that change is ever merged then
we can bump our clap_complete version and remove our use of value_terminator.

Related-to: #10
Related-to: clap-rs/clap#3022
Related-to: clap-rs/clap#4624
Signed-off-by: David Aguilar <davvid@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants