Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
a441f64d
Unverified
Commit
a441f64d
authored
Mar 25, 2019
by
Marc Cornellà
Committed by
GitHub
Mar 25, 2019
Browse files
Update _cargo completion to 0.34.0 version
parent
cf07fe2c
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/cargo/_cargo
View file @
a441f64d
#compdef cargo
#compdef cargo
typeset -A opt_args
autoload -U regexp-replace
autoload -U regexp-replace
zstyle -T ':completion:*:*:cargo:*' tag-order && \
zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
_cargo() {
_cargo() {
local context state state_descr line
typeset -A opt_args
# 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 \
_arguments \
'(- 1 *)'{-h,--help}'[show help message]' \
'(- 1 *)'{-h,--help}'[show help message]' \
'(- 1 *)--list[list installed commands]' \
'(- 1 *)'{-V,--version}'[show version information]' \
'(- 1 *)'{-V,--version}'[show version information]' \
'(- 1 *)'--list'[list installed commands]' \
{-v,--verbose}'[use verbose output]' \
'(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
--color'[colorization option]' \
'(- 1 *)'{-v,--verbose}'[use verbose output]' \
'(+beta +nightly)+stable[use the stable toolchain]' \
'(- 1 *)'--color'[colorization option]' \
'(+stable +nightly)+beta[use the beta toolchain]' \
'(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
'(+stable +beta)+nightly[use the nightly toolchain]' \
'(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
'1: :->command' \
'1: :_cargo_cmds' \
'*:: :->args'
'*:: :->args'
case $state in
case $state in
command)
_alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
;;
args)
args)
case $words[1] in
case $words[1] in
bench)
bench)
...
@@ -31,11 +45,10 @@ case $state in
...
@@ -31,11 +45,10 @@ case $state in
'--no-default-features[do not build the default features]' \
'--no-default-features[do not build the default features]' \
'--no-run[compile but do not run]' \
'--no-run[compile but do not run]' \
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
'(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
'--target=[target triple]
: :_get_targets
' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
;;
;;
build)
build)
...
@@ -49,11 +62,27 @@ case $state in
...
@@ -49,11 +62,27 @@ case $state in
'--no-default-features[do not build the default features]' \
'--no-default-features[do not build the default features]' \
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
'(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
'--release=[build in release mode]' \
'--release=[build in release mode]' \
'--target=[target triple]: :_get_targets' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--color=:colorization option:(auto always never)' \
;;
check)
_arguments \
'--features=[space separated feature list]' \
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
"${command_scope_spec[@]}" \
'--manifest-path=[path to manifest]: :_files -/' \
'--no-default-features[do not check the default features]' \
'(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
'--release=[check in release mode]' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
;;
;;
clean)
clean)
...
@@ -63,9 +92,9 @@ case $state in
...
@@ -63,9 +92,9 @@ case $state in
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
'(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[whether or not to clean release artifacts]' \
'--release[whether or not to clean release artifacts]' \
'--target=[target triple(default:all)]
: :_get_targets
' \
'--target=[target triple(default:all)]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
doc)
doc)
...
@@ -81,9 +110,9 @@ case $state in
...
@@ -81,9 +110,9 @@ case $state in
'(-p, --package)'{-p,--package}'=[package to document]' \
'(-p, --package)'{-p,--package}'=[package to document]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \
'--release[build artifacts in release mode, with optimizations]' \
'--target=[build for the target triple]
: :_get_targets
' \
'--target=[build for the target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
fetch)
fetch)
...
@@ -92,7 +121,7 @@ case $state in
...
@@ -92,7 +121,7 @@ case $state in
'--manifest-path=[path to manifest]: :_files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
generate-lockfile)
generate-lockfile)
...
@@ -101,17 +130,17 @@ case $state in
...
@@ -101,17 +130,17 @@ case $state in
'--manifest-path=[path to manifest]: :_files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
git-checkout)
git-checkout)
_arguments \
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'
q
(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--reference=[REF]' \
'--reference=[REF]' \
'--url=[URL]' \
'--url=[URL]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
help)
help)
...
@@ -128,14 +157,14 @@ case $state in
...
@@ -128,14 +157,14 @@ case $state in
'--name=[set the resulting package name]' \
'--name=[set the resulting package name]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
install)
install)
_arguments \
_arguments \
'--bin=[only install the specified binary]' \
'--bin=[only install the specified binary]' \
'--branch=[branch to use when installing from git]' \
'--branch=[branch to use when installing from git]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
'--debug[build in debug mode instead of release mode]' \
'--debug[build in debug mode instead of release mode]' \
'--example[install the specified example instead of binaries]' \
'--example[install the specified example instead of binaries]' \
'--features=[space separated feature list]' \
'--features=[space separated feature list]' \
...
@@ -144,10 +173,10 @@ case $state in
...
@@ -144,10 +173,10 @@ case $state in
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--no-default-features[do not build the default features]' \
'--no-default-features[do not build the default features]' \
'--path=[local filesystem path to crate to install]' \
'--path=[local filesystem path to crate to install]
: :_files -/
' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--rev=[specific commit to use when installing from git]' \
'--rev=[specific commit to use when installing from git]' \
'--root=[directory to install packages into]' \
'--root=[directory to install packages into]
: :_files -/
' \
'--tag=[tag to use when installing from git]' \
'--tag=[tag to use when installing from git]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--vers=[version to install from crates.io]' \
'--vers=[version to install from crates.io]' \
...
@@ -165,7 +194,7 @@ case $state in
...
@@ -165,7 +194,7 @@ case $state in
'--host=[Host to set the token for]' \
'--host=[Host to set the token for]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
metadata)
metadata)
...
@@ -179,7 +208,7 @@ case $state in
...
@@ -179,7 +208,7 @@ case $state in
'--features=[space separated feature list]' \
'--features=[space separated feature list]' \
'--all-features[enable all available features]' \
'--all-features[enable all available features]' \
'--format-version=[format version(default: 1)]' \
'--format-version=[format version(default: 1)]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
new)
new)
...
@@ -190,7 +219,7 @@ case $state in
...
@@ -190,7 +219,7 @@ case $state in
'--name=[set the resulting package name]' \
'--name=[set the resulting package name]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
owner)
owner)
...
@@ -203,7 +232,7 @@ case $state in
...
@@ -203,7 +232,7 @@ case $state in
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
'(-r, --remove)'{-r,--remove}'[remove owner LOGIN]' \
'--token[API token to use when authenticating]' \
'--token[API token to use when authenticating]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
package)
package)
...
@@ -215,7 +244,7 @@ case $state in
...
@@ -215,7 +244,7 @@ case $state in
'--no-verify[do not build to verify contents]' \
'--no-verify[do not build to verify contents]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
pkgid)
pkgid)
...
@@ -224,7 +253,7 @@ case $state in
...
@@ -224,7 +253,7 @@ case $state in
'--manifest-path=[path to manifest]: :_files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
publish)
publish)
...
@@ -236,7 +265,7 @@ case $state in
...
@@ -236,7 +265,7 @@ case $state in
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--token[token to use when uploading]' \
'--token[token to use when uploading]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
read-manifest)
read-manifest)
...
@@ -244,7 +273,7 @@ case $state in
...
@@ -244,7 +273,7 @@ case $state in
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
run)
run)
...
@@ -261,52 +290,49 @@ case $state in
...
@@ -261,52 +290,49 @@ case $state in
'--release=[build in release mode]' \
'--release=[build in release mode]' \
'--target=[target triple]' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
'*: :_normal' \
'*: :_normal' \
;;
;;
rustc)
rustc)
_arguments \
_arguments \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
'--features=[features to compile for the package]' \
'--features=[features to compile for the package]' \
'--all-features[enable all available features]' \
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to fetch dependencies for]' \
'--manifest-path=[path to the manifest to fetch dependencies for]
: :_files -/
' \
'--no-default-features[do not compile default features for the package]' \
'--no-default-features[do not compile default features for the package]' \
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
'(-p, --package)'{-p,--package}'=[profile to compile for]' \
'--profile=[profile to build the selected target for]' \
'--profile=[profile to build the selected target for]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \
'--release[build artifacts in release mode, with optimizations]' \
'--target=[target triple which compiles will be for]
: :_get_targets
' \
'--target=[target triple which compiles will be for]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
"${command_scope_spec[@]}" \
"${command_scope_spec[@]}" \
;;
;;
rustdoc)
rustdoc)
_arguments \
_arguments \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
'--features=[space-separated list of features to also build]' \
'--features=[space-separated list of features to also build]' \
'--all-features[enable all available features]' \
'--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to document]' \
'--manifest-path=[path to the manifest to document]
: :_files -/
' \
'--no-default-features[do not build the `default` feature]' \
'--no-default-features[do not build the `default` feature]' \
'--open[open the docs in a browser after the operation]' \
'--open[open the docs in a browser after the operation]' \
'(-p, --package)'{-p,--package}'=[package to document]' \
'(-p, --package)'{-p,--package}'=[package to document]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \
'--release[build artifacts in release mode, with optimizations]' \
'--target=[build for the target triple]
: :_get_targets
' \
'--target=[build for the target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
"${command_scope_spec[@]}" \
"${command_scope_spec[@]}" \
;;
;;
search)
search)
_arguments \
_arguments \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'--host=[host of a registry to search in]' \
'--host=[host of a registry to search in]' \
'--limit=[limit the number of results]' \
'--limit=[limit the number of results]' \
...
@@ -328,20 +354,28 @@ case $state in
...
@@ -328,20 +354,28 @@ case $state in
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
'(-p,--package)'{-p=,--package=}'[package to run tests for]:packages:_get_package_names' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'--release[build artifacts in release mode, with optimizations]' \
'--release[build artifacts in release mode, with optimizations]' \
'--target=[target triple]
: :_get_targets
' \
'--target=[target triple]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--message-format=[error format]:format option:(human json)' \
'--color=:colorization option:(auto always never)' \
'--color=[coloring]:colorization option:(auto always never)' \
'1: :_test_names' \
'1: :_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]' \
'--message-format:error format:(human json short)' \
'--frozen[require lock and cache up to date]' \
'--locked[require lock up to date]'
;;
;;
uninstall)
uninstall)
_arguments \
_arguments \
'--bin=[only uninstall the binary NAME]' \
'--bin=[only uninstall the binary NAME]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[less output printed to stdout]' \
'--root=[directory to uninstall packages from]' \
'--root=[directory to uninstall packages from]
: :_files -/
' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
;;
;;
...
@@ -354,7 +388,7 @@ case $state in
...
@@ -354,7 +388,7 @@ case $state in
'--precise=[update single dependency to PRECISE]: :' \
'--precise=[update single dependency to PRECISE]: :' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
verify-project)
verify-project)
...
@@ -363,14 +397,14 @@ case $state in
...
@@ -363,14 +397,14 @@ case $state in
'--manifest-path=[path to manifest]: :_files -/' \
'--manifest-path=[path to manifest]: :_files -/' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
version)
version)
_arguments \
_arguments \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
;;
;;
yank)
yank)
...
@@ -381,7 +415,7 @@ case $state in
...
@@ -381,7 +415,7 @@ case $state in
'--token[API token to use when authenticating]' \
'--token[API token to use when authenticating]' \
'--undo[undo a yank, putting a version back into the index]' \
'--undo[undo a yank, putting a version back into the index]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
'--color=
[coloring]
:colorization option:(auto always never)' \
'--color=:colorization option:(auto always never)' \
'--vers[yank version]' \
'--vers[yank version]' \
;;
;;
esac
esac
...
@@ -390,22 +424,22 @@ esac
...
@@ -390,22 +424,22 @@ esac
}
}
_cargo_cmds(){
_cargo_cmds(){
local IFS=$'\n'
local -a commands;commands=(
local -a commands;commands=(
'bench:execute all benchmarks of a local package'
'bench:execute all benchmarks of a local package'
'build:compile the current project'
'build:compile the current package'
'check:check the current package without compiling'
'clean:remove generated artifacts'
'clean:remove generated artifacts'
'doc:build package documentation'
'doc:build package documentation'
'fetch:fetch package dependencies'
'fetch:fetch package dependencies'
'generate-lockfile:create lockfile'
'generate-lockfile:create lockfile'
'git-checkout:git checkout'
'git-checkout:git checkout'
'help:get help for commands'
'help:get help for commands'
'init:create new p
roject
in current directory'
'init:create new p
ackage
in current directory'
'install:install a Rust binary'
'install:install a Rust binary'
'locate-project:print "Cargo.toml" location'
'locate-project:print "Cargo.toml" location'
'login:login to remote server'
'login:login to remote server'
'metadata:the metadata for a p
roject
in json'
'metadata:the metadata for a p
ackage
in json'
'new:create a new p
roject
'
'new:create a new p
ackage
'
'owner:manage the owners of a crate on the registry'
'owner:manage the owners of a crate on the registry'
'package:assemble local package into a distributable tarball'
'package:assemble local package into a distributable tarball'
'pkgid:print a fully qualified package specification'
'pkgid:print a fully qualified package specification'
...
@@ -421,10 +455,13 @@ local -a commands;commands=(
...
@@ -421,10 +455,13 @@ local -a commands;commands=(
'verify-project:check Cargo.toml'
'verify-project:check Cargo.toml'
'version:show version information'
'version:show version information'
'yank:remove pushed file from index'
'yank:remove pushed file from index'
$( cargo --list | sed -n '1!p' | tr -s ' ' | cut -d ' ' -f 2 | egrep -v "^bench$|^build$|^clean$|^doc$|^fetch$|^generate-lockfile$|^git-checkout$|^help$|^init$|^install$|^locate-project$|^login$|^metadata$|^new$|^owner$|^package$|^pkgid$|^publish$|^read-manifest$|^run$|^rustc$|^rustdoc$|^search$|^test$|^uninstall$|^update$|^verify-project$|^version$|^yank$" | sed "s/\(.*\)/echo \"\1:$\(cargo help \1 2>\&1 | head -n 1\)\"/" | sh )
)
)
_describe 'command' commands
_describe -t common-commands 'common commands' commands
}
_cargo_all_cmds(){
local -a commands;commands=($(cargo --list))
_describe -t all-commands 'all commands' commands
}
}
...
@@ -492,38 +529,7 @@ _benchmark_names()
...
@@ -492,38 +529,7 @@ _benchmark_names()
_get_names_from_array "bench"
_get_names_from_array "bench"
}
}
#Gets the target names from config files
# These flags are mutually exclusive specifiers for the scope of a command; as
_get_targets()
{
local CURRENT_PATH
if [[ $(uname -o) = "Cygwin" && -f "$PWD"/Cargo.toml ]]; then
CURRENT_PATH=$PWD
else
CURRENT_PATH=$(_locate_manifest)
fi
if [[ -z "$CURRENT_PATH" ]]; then
return 1
fi
local -a TARGETS
local -a FIND_PATHS=( "/" )
local -a FLINES
local FIND_PATH FLINE
while [[ "$CURRENT_PATH" != "/" ]]; do
FIND_PATHS+=( "$CURRENT_PATH" )
CURRENT_PATH=$(dirname $CURRENT_PATH)
done
for FIND_PATH in ${FIND_PATHS[@]}; do
if [[ -f "$FIND_PATH"/.cargo/config ]]; then
FLINES=( `grep "$FIND_PATH"/.cargo/config -e "^\[target\."` )
for FLINE in ${FLINES[@]}; do
TARGETS+=(`sed 's/^\[target\.\(.*\)\]$/\1/' <<< $FLINE`)
done
fi
done
_describe 'target' TARGETS
}
# These flags are mutally exclusive specifiers for the scope of a command; as
# they are used in multiple places without change, they are expanded into the
# they are used in multiple places without change, they are expanded into the
# appropriate command's `_arguments` where appropriate.
# appropriate command's `_arguments` where appropriate.
set command_scope_spec
set command_scope_spec
...
@@ -535,5 +541,4 @@ command_scope_spec=(
...
@@ -535,5 +541,4 @@ command_scope_spec=(
'(--bench --bin --example --lib)--test=[test name]'
'(--bench --bin --example --lib)--test=[test name]'
)
)
_cargo
_cargo
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment