From 450acc0113b114352ce3b94870fe63fc461844bd Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Tue, 7 Sep 2021 20:02:20 +0200 Subject: [PATCH] fix: automatically create completion for `cargo` and `rustup` plugins (#10087) --- plugins/cargo/.gitignore | 1 + plugins/cargo/_cargo | 407 ----------- plugins/cargo/cargo.plugin.zsh | 11 + plugins/rustup/.gitignore | 1 + plugins/rustup/_rustup | 1143 ------------------------------ plugins/rustup/rustup.plugin.zsh | 12 + 6 files changed, 25 insertions(+), 1550 deletions(-) create mode 100644 plugins/cargo/.gitignore delete mode 100644 plugins/cargo/_cargo create mode 100644 plugins/cargo/cargo.plugin.zsh create mode 100644 plugins/rustup/.gitignore delete mode 100644 plugins/rustup/_rustup create mode 100644 plugins/rustup/rustup.plugin.zsh diff --git a/plugins/cargo/.gitignore b/plugins/cargo/.gitignore new file mode 100644 index 000000000..42d7ecdd6 --- /dev/null +++ b/plugins/cargo/.gitignore @@ -0,0 +1 @@ +_cargo diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo deleted file mode 100644 index ebff99310..000000000 --- a/plugins/cargo/_cargo +++ /dev/null @@ -1,407 +0,0 @@ -#compdef cargo - -autoload -U regexp-replace - -_cargo() { - local curcontext="$curcontext" ret=1 - local -a command_scope_spec common parallel features msgfmt triple target registry - local -a state line state_descr # These are set by _arguments - typeset -A opt_args - - common=( - '(-q --quiet)*'{-v,--verbose}'[use verbose output]' - '(-q --quiet -v --verbose)'{-q,--quiet}'[no output printed to stdout]' - '-Z+[pass unstable (nightly-only) flags to cargo]: :_cargo_unstable_flags' - '--frozen[require that Cargo.lock and cache are up to date]' - '--locked[require that Cargo.lock is up to date]' - '--color=[specify colorization option]:coloring:(auto always never)' - '(- 1 *)'{-h,--help}'[show help message]' - ) - - # leading items in parentheses are an exclusion list for the arguments following that arg - # See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions - # - => exclude all other options - # 1 => exclude positional arg 1 - # * => exclude all other args - # +blah => exclude +blah - _arguments -s -S -C $common \ - '(- 1 *)--list[list installed commands]' \ - '(- 1 *)--explain=[provide a detailed explanation of an error message]:error code' \ - '(- 1 *)'{-V,--version}'[show version information]' \ - '(+beta +nightly)+stable[use the stable toolchain]' \ - '(+stable +nightly)+beta[use the beta toolchain]' \ - '(+stable +beta)+nightly[use the nightly toolchain]' \ - '1: :_cargo_cmds' \ - '*:: :->args' - - # These flags are mutually exclusive specifiers for the scope of a command; as - # they are used in multiple places without change, they are expanded into the - # appropriate command's `_arguments` where appropriate. - command_scope_spec=( - '(--bin --example --test --lib)--bench=[specify benchmark name]: :_cargo_benchmark_names' - '(--bench --bin --test --lib)--example=[specify example name]:example name' - '(--bench --example --test --lib)--bin=[specify binary name]:binary name' - '(--bench --bin --example --test)--lib=[specify library name]:library name' - '(--bench --bin --example --lib)--test=[specify test name]:test name' - ) - - parallel=( - '(-j --jobs)'{-j+,--jobs=}'[specify number of parallel jobs]:jobs [# of CPUs]' - ) - - features=( - '(--all-features)--features=[specify features to activate]:feature' - '(--features)--all-features[activate all available features]' - "--no-default-features[don't build the default features]" - ) - - msgfmt='--message-format=[specify error format]:error format [human]:(human json short)' - triple='--target=[specify target triple]:target triple' - target='--target-dir=[specify directory for all generated artifacts]:directory:_directories' - manifest='--manifest-path=[specify path to manifest]:path:_directories' - registry='--registry=[specify registry to use]:registry' - - case $state in - args) - curcontext="${curcontext%:*}-${words[1]}:" - case ${words[1]} in - bench) - _arguments -s -A "^--" $common $parallel $features $msgfmt $triple $target $manifest \ - "${command_scope_spec[@]}" \ - '--all-targets[benchmark all targets]' \ - "--no-run[compile but don't run]" \ - '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ - '--exclude=[exclude packages from the benchmark]:spec' \ - '--no-fail-fast[run all benchmarks regardless of failure]' \ - '1: :_guard "^-*" "bench name"' \ - '*:args:_default' - ;; - - build|b) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ - "${command_scope_spec[@]}" \ - '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ - '--release[build in release mode]' \ - '--build-plan[output the build plan in JSON]' \ - ;; - - check|c) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--all-targets[equivalent to specifying --lib --bins --tests --benches --examples]' \ - "${command_scope_spec[@]}" \ - '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ - '--release[check in release mode]' \ - ;; - - clean) - _arguments -s -S $common $triple $target $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to clean]:package:_cargo_package_names' \ - '--release[clean release artifacts]' \ - '--doc[clean just the documentation directory]' - ;; - - doc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--no-deps[do not build docs for dependencies]' \ - '--document-private-items[include non-public items in the documentation]' \ - '--open[open docs in browser after the build]' \ - '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ - '--release[build artifacts in release mode, with optimizations]' \ - ;; - - fetch) - _arguments -s -S $common $triple $manifest - ;; - - fix) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - "${command_scope_spec[@]}" \ - '--broken-code[fix code even if it already has compiler errors]' \ - '--edition[fix in preparation for the next edition]' \ - '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ - '--allow-no-vcs[fix code even if a VCS was not detected]' \ - '--allow-dirty[fix code even if the working directory is dirty]' \ - '--allow-staged[fix code even if the working directory has staged changes]' - ;; - - generate-lockfile) - _arguments -s -S $common $manifest - ;; - - git-checkout) - _arguments -s -S $common \ - '--reference=:reference' \ - '--url=:url:_urls' - ;; - - help) - _cargo_cmds - ;; - - init) - _arguments -s -S $common $registry \ - '--lib[use library template]' \ - '--edition=[specify edition to set for the crate generated]:edition:(2015 2018)' \ - '--vcs=[initialize a new repo with a given VCS]:vcs:(git hg pijul fossil none)' \ - '--name=[set the resulting package name]:name' \ - '1:path:_directories' - ;; - - install) - _arguments -s -S $common $parallel $features $triple $registry \ - '(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \ - '--bin=[only install the specified binary]:binary' \ - '--branch=[branch to use when installing from git]:branch' \ - '--debug[build in debug mode instead of release mode]' \ - '--example=[install the specified example instead of binaries]:example' \ - '--git=[specify URL from which to install the crate]:url:_urls' \ - '--path=[local filesystem path to crate to install]: :_directories' \ - '--rev=[specific commit to use when installing from git]:commit' \ - '--root=[directory to install packages into]: :_directories' \ - '--tag=[tag to use when installing from git]:tag' \ - '--vers=[version to install from crates.io]:version' \ - '--list[list all installed packages and their versions]' \ - '*: :_guard "^-*" "crate"' - ;; - - locate-project) - _arguments -s -S $common $manifest - ;; - - login) - _arguments -s -S $common $registry \ - '*: :_guard "^-*" "token"' - ;; - - metadata) - _arguments -s -S $common $features $manifest \ - "--no-deps[output information only about the root package and don't fetch dependencies]" \ - '--format-version=[specify format version]:version [1]:(1)' - ;; - - new) - _arguments -s -S $common $registry \ - '--lib[use library template]' \ - '--vcs:initialize a new repo with a given VCS:(git hg none)' \ - '--name=[set the resulting package name]' - ;; - - owner) - _arguments -s -S $common $registry \ - '(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \ - '--index=[specify registry index]:index' \ - '(-l --list)'{-l,--list}'[list owners of a crate]' \ - '(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \ - '--token=[specify API token to use when authenticating]:token' \ - '*: :_guard "^-*" "crate"' - ;; - - package) - _arguments -s -S $common $parallel $features $triple $target $manifest \ - '(-l --list)'{-l,--list}'[print files included in a package without making one]' \ - '--no-metadata[ignore warnings about a lack of human-usable metadata]' \ - '--allow-dirty[allow dirty working directories to be packaged]' \ - "--no-verify[don't build to verify contents]" - ;; - - pkgid) - _arguments -s -S $common $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to get ID specifier for]:package:_cargo_package_names' \ - '*: :_guard "^-*" "spec"' - ;; - - publish) - _arguments -s -S $common $parallel $features $triple $target $manifest $registry \ - '--index=[specify registry index]:index' \ - '--allow-dirty[allow dirty working directories to be packaged]' \ - "--no-verify[don't verify the contents by building them]" \ - '--token=[specify token to use when uploading]:token' \ - '--dry-run[perform all checks without uploading]' - ;; - - read-manifest) - _arguments -s -S $common $manifest - ;; - - run|r) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--example=[name of the bin target]:name' \ - '--bin=[name of the bin target]:name' \ - '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ - '--release[build in release mode]' \ - '*: :_default' - ;; - - rustc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ - '--profile=[specify profile to build the selected target for]:profile' \ - '--release[build artifacts in release mode, with optimizations]' \ - "${command_scope_spec[@]}" \ - '*: : _dispatch rustc rustc -default-' - ;; - - rustdoc) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--document-private-items[include non-public items in the documentation]' \ - '--open[open the docs in a browser after the operation]' \ - '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ - '--release[build artifacts in release mode, with optimizations]' \ - "${command_scope_spec[@]}" \ - '*: : _dispatch rustdoc rustdoc -default-' - ;; - - search) - _arguments -s -S $common $registry \ - '--index=[specify registry index]:index' \ - '--limit=[limit the number of results]:results [10]' \ - '*: :_guard "^-*" "query"' - ;; - - test|t) - _arguments -s -S $common $parallel $features $msgfmt $triple $target $manifest \ - '--test=[test name]: :_cargo_test_names' \ - '--no-fail-fast[run all tests regardless of failure]' \ - '--no-run[compile but do not run]' \ - '(-p --package)'{-p+,--package=}'[package to run tests for]:package:_cargo_package_names' \ - '--all[test all packages in the workspace]' \ - '--release[build artifacts in release mode, with optimizations]' \ - '1: :_cargo_test_names' \ - '(--doc --bin --example --test --bench)--lib[only test library]' \ - '(--lib --bin --example --test --bench)--doc[only test documentation]' \ - '(--lib --doc --example --test --bench)--bin=[binary name]' \ - '(--lib --doc --bin --test --bench)--example=[example name]' \ - '(--lib --doc --bin --example --bench)--test=[test name]' \ - '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ - '*: :_default' - ;; - - uninstall) - _arguments -s -S $common \ - '(-p --package)'{-p+,--package=}'[specify package to uninstall]:package:_cargo_package_names' \ - '--bin=[only uninstall the specified binary]:name' \ - '--root=[directory to uninstall packages from]: :_files -/' \ - '*:crate:_cargo_installed_crates -F line' - ;; - - update) - _arguments -s -S $common $manifest \ - '--aggressive=[force dependency update]' \ - "--dry-run[don't actually write the lockfile]" \ - '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ - '--precise=[update single dependency to precise release]:release' - ;; - - verify-project) - _arguments -s -S $common $manifest - ;; - - version) - _arguments -s -S $common - ;; - - yank) - _arguments -s -S $common $registry \ - '--vers=[specify yank version]:version' \ - '--undo[undo a yank, putting a version back into the index]' \ - '--index=[specify registry index to yank from]:registry index' \ - '--token=[specify API token to use when authenticating]:token' \ - '*: :_guard "^-*" "crate"' - ;; - *) - # allow plugins to define their own functions - if ! _call_function ret _cargo-${words[1]}; then - # fallback on default completion for unknown commands - _default && ret=0 - fi - (( ! ret )) - ;; - esac - ;; - esac -} - -_cargo_unstable_flags() { - local flags - flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } ) - _describe -t flags 'unstable flag' flags -} - -_cargo_installed_crates() { - local expl - _description crates expl 'crate' - compadd "$@" "$expl[@]" - ${${${(f)"$(cargo install --list)"}:# *}%% *} -} - -_cargo_cmds() { - local -a commands - # This uses Parameter Expansion Flags, which are a built-in Zsh feature. - # See more: http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags - # and http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion - # - # # How this work? - # - # First it splits the result of `cargo --list` at newline, then it removes the first line. - # Then it removes indentation (4 whitespaces) before each items. (Note the x## pattern [1]). - # Then it replaces those spaces between item and description with a `:` - # - # [1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org#patterns - commands=( ${${${(M)"${(f)$(_call_program commands cargo --list)}":# *}/ ##/}/ ##/:} ) - _describe -t commands 'command' commands -} - - -#FIXME: Disabled until fixed -#gets package names from the manifest file -_cargo_package_names() { - _message -e packages package -} - -# Extracts the values of "name" from the array given in $1 and shows them as -# command line options for completion -_cargo_names_from_array() { - # strip json from the path - local manifest=${${${"$(cargo locate-project)"}%\"\}}##*\"} - if [[ -z $manifest ]]; then - return 0 - fi - - local last_line - local -a names; - local in_block=false - local block_name=$1 - names=() - while read -r line; do - if [[ $last_line == "[[$block_name]]" ]]; then - in_block=true - else - if [[ $last_line =~ '\s*\[\[.*' ]]; then - in_block=false - fi - fi - - if [[ $in_block == true ]]; then - if [[ $line =~ '\s*name\s*=' ]]; then - regexp-replace line '^\s*name\s*=\s*|"' '' - names+=( "$line" ) - fi - fi - - last_line=$line - done < "$manifest" - _describe "$block_name" names - -} - -#Gets the test names from the manifest file -_cargo_test_names() { - _cargo_names_from_array "test" -} - -#Gets the bench names from the manifest file -_cargo_benchmark_names() { - _cargo_names_from_array "bench" -} - -_cargo diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh new file mode 100644 index 000000000..92eae5359 --- /dev/null +++ b/plugins/cargo/cargo.plugin.zsh @@ -0,0 +1,11 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] && $+commands[cargo] )); then + if [[ ! -f $ZSH_CACHE_DIR/cargo_version ]] \ + || [[ "$(cargo --version)" != "$(< "$ZSH_CACHE_DIR/cargo_version")" ]] \ + || [[ ! -f $ZSH/plugins/cargo/_cargo ]]; then + rustup completions zsh cargo > $ZSH/plugins/cargo/_cargo + cargo --version > $ZSH_CACHE_DIR/cargo_version + fi + autoload -Uz _cargo + _comps[cargo]=_cargo +fi diff --git a/plugins/rustup/.gitignore b/plugins/rustup/.gitignore new file mode 100644 index 000000000..ad38ae3bf --- /dev/null +++ b/plugins/rustup/.gitignore @@ -0,0 +1 @@ +_rustup diff --git a/plugins/rustup/_rustup b/plugins/rustup/_rustup deleted file mode 100644 index dab33533a..000000000 --- a/plugins/rustup/_rustup +++ /dev/null @@ -1,1143 +0,0 @@ -#compdef rustup - -autoload -U is-at-least - -_rustup() { - typeset -A opt_args - typeset -a _arguments_options - local ret=1 - - if is-at-least 5.2; then - _arguments_options=(-s -S -C) - else - _arguments_options=(-s -C) - fi - - local context curcontext="$curcontext" state line - _arguments "${_arguments_options[@]}" \ -'-v[Enable verbose output]' \ -'--verbose[Enable verbose output]' \ -'(-v --verbose)-q[Disable progress output]' \ -'(-v --verbose)--quiet[Disable progress output]' \ -'-h[Prints help information]' \ -'--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' \ -":: :_rustup_commands" \ -"*::: :->rustup" \ -&& ret=0 - case $state in - (rustup) - words=($line[2] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-command-$line[2]:" - case $line[2] in - (dump-testament) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(show) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__show_commands" \ -"*::: :->show" \ -&& ret=0 -case $state in - (show) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-show-command-$line[1]:" - case $line[1] in - (active-toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(home) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(profile) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(keys) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(install) -_arguments "${_arguments_options[@]}" \ -'--profile=[]: :(minimal default complete)' \ -'--no-self-update[Don'\''t perform self-update when running the `rustup install` command]' \ -'--force[Force an update, even if some components are missing]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'--no-self-update[Don'\''t perform self update when running the `rustup update` command]' \ -'--force[Force an update, even if some components are missing]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(check) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(default) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(toolchain) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__toolchain_commands" \ -"*::: :->toolchain" \ -&& ret=0 -case $state in - (toolchain) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-toolchain-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-v[Enable verbose output with toolchain information]' \ -'--verbose[Enable verbose output with toolchain information]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(update) -_arguments "${_arguments_options[@]}" \ -'--profile=[]: :(minimal default complete)' \ -'*-c+[Add specific components on installation]' \ -'*--component=[Add specific components on installation]' \ -'*-t+[Add specific targets on installation]' \ -'*--target=[Add specific targets on installation]' \ -'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ -'--force[Force an update, even if some components are missing]' \ -'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--profile=[]: :(minimal default complete)' \ -'*-c+[Add specific components on installation]' \ -'*--component=[Add specific components on installation]' \ -'*-t+[Add specific targets on installation]' \ -'*--target=[Add specific targets on installation]' \ -'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ -'--force[Force an update, even if some components are missing]' \ -'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'--profile=[]: :(minimal default complete)' \ -'*-c+[Add specific components on installation]' \ -'*--component=[Add specific components on installation]' \ -'*-t+[Add specific targets on installation]' \ -'*--target=[Add specific targets on installation]' \ -'--no-self-update[Don'\''t perform self update when running the`rustup toolchain install` command]' \ -'--force[Force an update, even if some components are missing]' \ -'--allow-downgrade[Allow rustup to downgrade the toolchain to satisfy your component choice]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(link) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':path:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(target) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__target_commands" \ -"*::: :->target" \ -&& ret=0 -case $state in - (target) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-target-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--installed[List only installed targets]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(install) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target -- List of targets to install; "all" installs all available targets:_files' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target -- List of targets to install; "all" installs all available targets:_files' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':target:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(component) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__component_commands" \ -"*::: :->component" \ -&& ret=0 -case $state in - (component) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-component-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--installed[List only installed components]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--target=[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':component:_files' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(override) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__override_commands" \ -"*::: :->override" \ -&& ret=0 -case $state in - (override) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-override-command-$line[1]:" - case $line[1] in - (list) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(add) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(set) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -&& ret=0 -;; -(remove) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(unset) -_arguments "${_arguments_options[@]}" \ -'--path=[Path to the directory]' \ -'--nonexistent[Remove override toolchain for all nonexistent directories]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(run) -_arguments "${_arguments_options[@]}" \ -'--install[Install the requested toolchain if needed]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':toolchain -- Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see `rustup help toolchain`:_files' \ -':command:_files' \ -&& ret=0 -;; -(which) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(docs) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--path[Only print the path to the documentation]' \ -'--alloc[The Rust core allocation and collections library]' \ -'--book[The Rust Programming Language book]' \ -'--cargo[The Cargo Book]' \ -'--core[The Rust Core Library]' \ -'--edition-guide[The Rust Edition Guide]' \ -'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ -'--proc_macro[A support library for macro authors when defining new macros]' \ -'--reference[The Rust Reference]' \ -'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ -'--rustc[The compiler for the Rust programming language]' \ -'--rustdoc[Generate documentation for Rust projects]' \ -'--std[Standard library API documentation]' \ -'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ -'--unstable-book[The Unstable Book]' \ -'--embedded-book[The Embedded Rust Book]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ -&& ret=0 -;; -(doc) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'--path[Only print the path to the documentation]' \ -'--alloc[The Rust core allocation and collections library]' \ -'--book[The Rust Programming Language book]' \ -'--cargo[The Cargo Book]' \ -'--core[The Rust Core Library]' \ -'--edition-guide[The Rust Edition Guide]' \ -'--nomicon[The Dark Arts of Advanced and Unsafe Rust Programming]' \ -'--proc_macro[A support library for macro authors when defining new macros]' \ -'--reference[The Rust Reference]' \ -'--rust-by-example[A collection of runnable examples that illustrate various Rust concepts and standard libraries]' \ -'--rustc[The compiler for the Rust programming language]' \ -'--rustdoc[Generate documentation for Rust projects]' \ -'--std[Standard library API documentation]' \ -'--test[Support code for rustc'\''s built in unit-test and micro-benchmarking framework]' \ -'--unstable-book[The Unstable Book]' \ -'--embedded-book[The Embedded Rust Book]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::topic -- Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', 'std::io::error::Result' etc...:_files' \ -&& ret=0 -;; -(man) -_arguments "${_arguments_options[@]}" \ -'--toolchain=[Toolchain name, such as '\''stable'\'', '\''nightly'\'', or '\''1.8.0'\''. For more information see `rustup help toolchain`]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':command:_files' \ -&& ret=0 -;; -(self) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__self_commands" \ -"*::: :->self" \ -&& ret=0 -case $state in - (self) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-self-command-$line[1]:" - case $line[1] in - (update) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(uninstall) -_arguments "${_arguments_options[@]}" \ -'-y[]' \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(upgrade-data) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(set) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -":: :_rustup__set_commands" \ -"*::: :->set" \ -&& ret=0 -case $state in - (set) - words=($line[1] "${words[@]}") - (( CURRENT += 1 )) - curcontext="${curcontext%:*:*}:rustup-set-command-$line[1]:" - case $line[1] in - (default-host) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':host_triple:_files' \ -&& ret=0 -;; -(profile) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -':profile-name:(minimal default complete)' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -;; -(completions) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -'::shell:(zsh bash fish powershell elvish)' \ -'::command:(rustup cargo)' \ -&& ret=0 -;; -(help) -_arguments "${_arguments_options[@]}" \ -'-h[Prints help information]' \ -'--help[Prints help information]' \ -'-V[Prints version information]' \ -'--version[Prints version information]' \ -&& ret=0 -;; - esac - ;; -esac -} - -(( $+functions[_rustup_commands] )) || -_rustup_commands() { - local commands; commands=( - "dump-testament:Dump information about the build" \ -"show:Show the active and installed toolchains or profiles" \ -"install:Update Rust toolchains" \ -"uninstall:Uninstall Rust toolchains" \ -"update:Update Rust toolchains and rustup" \ -"check:Check for updates to Rust toolchains" \ -"default:Set the default toolchain" \ -"toolchain:Modify or query the installed toolchains" \ -"target:Modify a toolchain's supported targets" \ -"component:Modify a toolchain's installed components" \ -"override:Modify directory toolchain overrides" \ -"run:Run a command with an environment configured for a given toolchain" \ -"which:Display which binary will be run for a given command" \ -"doc:Open the documentation for the current toolchain" \ -"man:View the man page for a given command" \ -"self:Modify the rustup installation" \ -"set:Alter rustup settings" \ -"completions:Generate tab-completion scripts for your shell" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup commands' commands "$@" -} -(( $+functions[_rustup__show__active-toolchain_commands] )) || -_rustup__show__active-toolchain_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show active-toolchain commands' commands "$@" -} -(( $+functions[_rustup__add_commands] )) || -_rustup__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup add commands' commands "$@" -} -(( $+functions[_rustup__component__add_commands] )) || -_rustup__component__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component add commands' commands "$@" -} -(( $+functions[_rustup__override__add_commands] )) || -_rustup__override__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override add commands' commands "$@" -} -(( $+functions[_rustup__target__add_commands] )) || -_rustup__target__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target add commands' commands "$@" -} -(( $+functions[_rustup__toolchain__add_commands] )) || -_rustup__toolchain__add_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain add commands' commands "$@" -} -(( $+functions[_rustup__check_commands] )) || -_rustup__check_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup check commands' commands "$@" -} -(( $+functions[_rustup__completions_commands] )) || -_rustup__completions_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup completions commands' commands "$@" -} -(( $+functions[_rustup__component_commands] )) || -_rustup__component_commands() { - local commands; commands=( - "list:List installed and available components" \ -"add:Add a component to a Rust toolchain" \ -"remove:Remove a component from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup component commands' commands "$@" -} -(( $+functions[_rustup__default_commands] )) || -_rustup__default_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup default commands' commands "$@" -} -(( $+functions[_rustup__set__default-host_commands] )) || -_rustup__set__default-host_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set default-host commands' commands "$@" -} -(( $+functions[_rustup__doc_commands] )) || -_rustup__doc_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup doc commands' commands "$@" -} -(( $+functions[_docs_commands] )) || -_docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'docs commands' commands "$@" -} -(( $+functions[_rustup__docs_commands] )) || -_rustup__docs_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup docs commands' commands "$@" -} -(( $+functions[_rustup__dump-testament_commands] )) || -_rustup__dump-testament_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup dump-testament commands' commands "$@" -} -(( $+functions[_rustup__component__help_commands] )) || -_rustup__component__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component help commands' commands "$@" -} -(( $+functions[_rustup__help_commands] )) || -_rustup__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup help commands' commands "$@" -} -(( $+functions[_rustup__override__help_commands] )) || -_rustup__override__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override help commands' commands "$@" -} -(( $+functions[_rustup__self__help_commands] )) || -_rustup__self__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self help commands' commands "$@" -} -(( $+functions[_rustup__set__help_commands] )) || -_rustup__set__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set help commands' commands "$@" -} -(( $+functions[_rustup__show__help_commands] )) || -_rustup__show__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show help commands' commands "$@" -} -(( $+functions[_rustup__target__help_commands] )) || -_rustup__target__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target help commands' commands "$@" -} -(( $+functions[_rustup__toolchain__help_commands] )) || -_rustup__toolchain__help_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain help commands' commands "$@" -} -(( $+functions[_rustup__show__home_commands] )) || -_rustup__show__home_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show home commands' commands "$@" -} -(( $+functions[_rustup__install_commands] )) || -_rustup__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup install commands' commands "$@" -} -(( $+functions[_rustup__target__install_commands] )) || -_rustup__target__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target install commands' commands "$@" -} -(( $+functions[_rustup__toolchain__install_commands] )) || -_rustup__toolchain__install_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain install commands' commands "$@" -} -(( $+functions[_rustup__show__keys_commands] )) || -_rustup__show__keys_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show keys commands' commands "$@" -} -(( $+functions[_rustup__toolchain__link_commands] )) || -_rustup__toolchain__link_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain link commands' commands "$@" -} -(( $+functions[_rustup__component__list_commands] )) || -_rustup__component__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component list commands' commands "$@" -} -(( $+functions[_rustup__override__list_commands] )) || -_rustup__override__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override list commands' commands "$@" -} -(( $+functions[_rustup__target__list_commands] )) || -_rustup__target__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target list commands' commands "$@" -} -(( $+functions[_rustup__toolchain__list_commands] )) || -_rustup__toolchain__list_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain list commands' commands "$@" -} -(( $+functions[_rustup__man_commands] )) || -_rustup__man_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup man commands' commands "$@" -} -(( $+functions[_rustup__override_commands] )) || -_rustup__override_commands() { - local commands; commands=( - "list:List directory toolchain overrides" \ -"set:Set the override toolchain for a directory" \ -"unset:Remove the override toolchain for a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup override commands' commands "$@" -} -(( $+functions[_rustup__set__profile_commands] )) || -_rustup__set__profile_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup set profile commands' commands "$@" -} -(( $+functions[_rustup__show__profile_commands] )) || -_rustup__show__profile_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup show profile commands' commands "$@" -} -(( $+functions[_rustup__component__remove_commands] )) || -_rustup__component__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup component remove commands' commands "$@" -} -(( $+functions[_rustup__override__remove_commands] )) || -_rustup__override__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override remove commands' commands "$@" -} -(( $+functions[_rustup__remove_commands] )) || -_rustup__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup remove commands' commands "$@" -} -(( $+functions[_rustup__target__remove_commands] )) || -_rustup__target__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target remove commands' commands "$@" -} -(( $+functions[_rustup__toolchain__remove_commands] )) || -_rustup__toolchain__remove_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain remove commands' commands "$@" -} -(( $+functions[_rustup__run_commands] )) || -_rustup__run_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup run commands' commands "$@" -} -(( $+functions[_rustup__self_commands] )) || -_rustup__self_commands() { - local commands; commands=( - "update:Download and install updates to rustup" \ -"uninstall:Uninstall rustup." \ -"upgrade-data:Upgrade the internal data format." \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup self commands' commands "$@" -} -(( $+functions[_rustup__override__set_commands] )) || -_rustup__override__set_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override set commands' commands "$@" -} -(( $+functions[_rustup__set_commands] )) || -_rustup__set_commands() { - local commands; commands=( - "default-host:The triple used to identify toolchains when not specified" \ -"profile:The default components installed" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup set commands' commands "$@" -} -(( $+functions[_rustup__show_commands] )) || -_rustup__show_commands() { - local commands; commands=( - "active-toolchain:Show the active toolchain" \ -"home:Display the computed value of RUSTUP_HOME" \ -"profile:Show the current profile" \ -"keys:Display the known PGP keys" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup show commands' commands "$@" -} -(( $+functions[_rustup__target_commands] )) || -_rustup__target_commands() { - local commands; commands=( - "list:List installed and available targets" \ -"add:Add a target to a Rust toolchain" \ -"remove:Remove a target from a Rust toolchain" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup target commands' commands "$@" -} -(( $+functions[_rustup__toolchain_commands] )) || -_rustup__toolchain_commands() { - local commands; commands=( - "list:List installed toolchains" \ -"install:Install or update a given toolchain" \ -"uninstall:Uninstall a toolchain" \ -"link:Create a custom toolchain by symlinking to a directory" \ -"help:Prints this message or the help of the given subcommand(s)" \ - ) - _describe -t commands 'rustup toolchain commands' commands "$@" -} -(( $+functions[_rustup__self__uninstall_commands] )) || -_rustup__self__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self uninstall commands' commands "$@" -} -(( $+functions[_rustup__target__uninstall_commands] )) || -_rustup__target__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup target uninstall commands' commands "$@" -} -(( $+functions[_rustup__toolchain__uninstall_commands] )) || -_rustup__toolchain__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain uninstall commands' commands "$@" -} -(( $+functions[_rustup__uninstall_commands] )) || -_rustup__uninstall_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup uninstall commands' commands "$@" -} -(( $+functions[_rustup__override__unset_commands] )) || -_rustup__override__unset_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup override unset commands' commands "$@" -} -(( $+functions[_rustup__self__update_commands] )) || -_rustup__self__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self update commands' commands "$@" -} -(( $+functions[_rustup__toolchain__update_commands] )) || -_rustup__toolchain__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup toolchain update commands' commands "$@" -} -(( $+functions[_rustup__update_commands] )) || -_rustup__update_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup update commands' commands "$@" -} -(( $+functions[_rustup__self__upgrade-data_commands] )) || -_rustup__self__upgrade-data_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup self upgrade-data commands' commands "$@" -} -(( $+functions[_rustup__which_commands] )) || -_rustup__which_commands() { - local commands; commands=( - - ) - _describe -t commands 'rustup which commands' commands "$@" -} - -_rustup "$@" \ No newline at end of file diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh new file mode 100644 index 000000000..c7a9b3060 --- /dev/null +++ b/plugins/rustup/rustup.plugin.zsh @@ -0,0 +1,12 @@ +# COMPLETION FUNCTION +if (( $+commands[rustup] )); then + if [[ ! -f $ZSH_CACHE_DIR/rustup_version ]] \ + || [[ "$(rustup --version 2> /dev/null)" \ + != "$(< "$ZSH_CACHE_DIR/rustup_version")" ]] \ + || [[ ! -f $ZSH/plugins/rustup/_rustup ]]; then + rustup completions zsh > $ZSH/plugins/rustup/_rustup + rustup --version 2> /dev/null > $ZSH_CACHE_DIR/rustup_version + fi + autoload -Uz _rustup + _comps[rustup]=_rustup +fi