-
Notifications
You must be signed in to change notification settings - Fork 894
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
Duplicative auto completions #2268
Comments
A temporary fix for those who need it: --- _rustup 2020-03-18 19:08:18.865256496 +0800
+++ _rustup_fix 2020-03-18 18:42:23.837856740 +0800
@@ -23,16 +23,18 @@
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
-'::+toolchain -- release channel (e.g. +stable) or custom toolchain to set override:_files' \
+'(+beta +nightly)+stable[use the stable toolchain]' \
+'(+stable +nightly)+beta[use the beta toolchain]' \
+'(+stable +beta)+nightly[use the nightly toolchain]' \
":: :_rustup_commands" \
"*::: :->rustup" \
&& ret=0
case $state in
(rustup)
- words=($line[2] "${words[@]}")
+ words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
- curcontext="${curcontext%:*:*}:rustup-command-$line[2]:"
- case $line[2] in
+ curcontext="${curcontext%:*:*}:rustup-command-$line[1]:"
+ case $line[1] in
(dump-testament)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \ |
Hi, so in theory we need to work out whether (a) clap needs updates and if so what, and (b) whether rustup needs updates in order to support completion better. Do you have any experience with clap and completions generation? If we could tell clap enough that it'd be able to at least say this field only makes sense if it starts with a |
Sorry, I don't know much about them. To be honest, I'm not confident with let clap generate the correct completion automatically. Ummm, I can't come up with a perfect way to solve it. I prefer to something like Just personal opinion. |
I don't really want |
Looks like clap-rs/clap#1232 is the issue to track for this |
Currently
This would be interesting to look at. |
Problem
#2031 add a special argument
+toolchain
, this breaks the zsh completion script generated by clap.Detail
+toolchain
is treated as a positional argument by clap, this brings two problems:rustup \t
will also generate file list because+toolchain
is treated as a file.+toolchain
, so the completion script thinks the real subcommand starts from the 2nd argument. This means onlyrustup xxx toolchain \t
will generate completion fortoolchain
subcommand.Steps
rustup completions zsh > a_dir_in_fpath/_rustup
rustup \t
, you will see both rustup commands and local files (they shouldn't exist) in candidates.rustup toolchain \t
, you will still see rustup commands, not rustup toolchain commands.Possible Solution(s)
Notes
Output of
rustup --version
:rustup 1.21.1 (2020-02-23)
Output of
rustup show
:The text was updated successfully, but these errors were encountered: