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.
- the first argument is occupied by
+toolchain, so the completion script thinks the real subcommand starts from the 2nd argument. This means only rustup xxx toolchain \t will generate completion for toolchain subcommand.
Steps
- generate the completion script:
rustup completions zsh > a_dir_in_fpath/_rustup
- type
rustup \t, you will see both rustup commands and local files (they shouldn't exist) in candidates.
- type
rustup toolchain \t, you will still see rustup commands, not rustup toolchain commands.
Possible Solution(s)
- Throw this issue to clap
- Use a (semi-)hand-written completion script
- Do a search-and-replace in clap's output
Notes
Output of rustup --version: rustup 1.21.1 (2020-02-23)
Output of rustup show:
Default host: x86_64-unknown-linux-gnu
rustup home: /home/aloxaf/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-2019-12-20-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
--------------------------------------
wasm32-unknown-unknown
x86_64-pc-windows-gnu
x86_64-unknown-linux-gnu
active toolchain
----------------
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.43.0-nightly (d3c79346a 2020-02-29)
Problem
#2031 add a special argument
+toolchain, this breaks the zsh completion script generated by clap.Detail
+toolchainis treated as a positional argument by clap, this brings two problems:rustup \twill also generate file list because+toolchainis treated as a file.+toolchain, so the completion script thinks the real subcommand starts from the 2nd argument. This means onlyrustup xxx toolchain \twill generate completion fortoolchainsubcommand.Steps
rustup completions zsh > a_dir_in_fpath/_rustuprustup \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: