rustup icon indicating copy to clipboard operation
rustup copied to clipboard

Duplicative auto completions

Open Aloxaf opened this issue 5 years ago • 8 comments

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:

  1. rustup \t will also generate file list because +toolchain is treated as a file.
  2. 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

  1. generate the completion script: rustup completions zsh > a_dir_in_fpath/_rustup
  2. type rustup \t, you will see both rustup commands and local files (they shouldn't exist) in candidates.
  3. type rustup toolchain \t, you will still see rustup commands, not rustup toolchain commands.

Possible Solution(s)

  1. Throw this issue to clap
  2. Use a (semi-)hand-written completion script
  3. 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)

Aloxaf avatar Mar 18 '20 11:03 Aloxaf