Eschew hard-coding rustup components in favor of a hack

[ci skip]
This commit is contained in:
Mahmoud Al-Qudsi 2019-09-10 03:23:35 -05:00
parent 32546d6491
commit 58cd1a5140

View file

@ -17,18 +17,10 @@ set -l subcmds \
# "completions" \ # "completions" \
"help" "help"
# rustup does not expose a mechanism of retrieving a list of all valid components (including non-installed) # rustup does not really expose a mechanism of retrieving a list of all valid components without the archs appended
set __rustup_components \ function __rustup_components
"cargo" \ rustup component list | string match -r "^\S+" | string replace -f -- "-x86_64-unknown-linux-gnu" ""
"clippy" \ end
"lldb-preview" \
"llvm-tools-preview" \
"miri" \
"rls" \
"rust-analysis" \
"rust-docs" \
"rust-mingw" \
"rust-src"
# function __rustup_installable_components # function __rustup_installable_components
# set -l not_installed (comm -2 -3 (printf "%s\n" $__rustup_components | psub -F) (rustup component list --installed | psub -F) 2>/dev/null) # set -l not_installed (comm -2 -3 (printf "%s\n" $__rustup_components | psub -F) (rustup component list --installed | psub -F) 2>/dev/null)
@ -251,7 +243,7 @@ complete -c rustup -n "__fish_seen_subcommand_from toolchain; and __fish_prev_ar
complete -c rustup -n "__fish_seen_subcommand_from component; and __fish_prev_arg_in remove uninstall" \ complete -c rustup -n "__fish_seen_subcommand_from component; and __fish_prev_arg_in remove uninstall" \
-xa "(__rustup_installed_components)" -xa "(__rustup_installed_components)"
complete -c rustup -n "__fish_seen_subcommand_from component; and __fish_prev_arg_in add install" \ complete -c rustup -n "__fish_seen_subcommand_from component; and __fish_prev_arg_in add install" \
-xa "$__rustup_components" -xa "(__rustup_components)"
complete -c rustup -n "__fish_seen_subcommand_from set; and __fish_prev_arg_in default-host" \ complete -c rustup -n "__fish_seen_subcommand_from set; and __fish_prev_arg_in default-host" \
-xa "(__rustup_triples)" -xa "(__rustup_triples)"