a441f64d090d30856a1f56a10820b219ffc10e18
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/cargo/_cargo b/plugins/cargo/_cargo
2index a8c58ecc568a5686a007eba1a79e5d6ea12854b6..395c517cd37e5a3e2e82d8b6db627b3a48ba9c85 100644
3--- a/plugins/cargo/_cargo
4+++ b/plugins/cargo/_cargo
5@@ -1,23 +1,37 @@
6 #compdef cargo
7
8-typeset -A opt_args
9 autoload -U regexp-replace
10
11+zstyle -T ':completion:*:*:cargo:*' tag-order && \
12+ zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
13+
14 _cargo() {
15+local context state state_descr line
16+typeset -A opt_args
17
18+# leading items in parentheses are an exclusion list for the arguments following that arg
19+# See: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-Functions
20+# - => exclude all other options
21+# 1 => exclude positional arg 1
22+# * => exclude all other args
23+# +blah => exclude +blah
24 _arguments \
25 '(- 1 *)'{-h,--help}'[show help message]' \
26+ '(- 1 *)--list[list installed commands]' \
27 '(- 1 *)'{-V,--version}'[show version information]' \
28- '(- 1 *)'--list'[list installed commands]' \
29- '(- 1 *)'--explain'[Run `rustc --explain CODE`]' \
30- '(- 1 *)'{-v,--verbose}'[use verbose output]' \
31- '(- 1 *)'--color'[colorization option]' \
32- '(- 1 *)'--frozen'[Require Cargo.lock and cache are up to date]' \
33- '(- 1 *)'--locked'[Require Cargo.lock is up to date]' \
34- '1: :_cargo_cmds' \
35+ {-v,--verbose}'[use verbose output]' \
36+ --color'[colorization option]' \
37+ '(+beta +nightly)+stable[use the stable toolchain]' \
38+ '(+stable +nightly)+beta[use the beta toolchain]' \
39+ '(+stable +beta)+nightly[use the nightly toolchain]' \
40+ '1: :->command' \
41 '*:: :->args'
42
43 case $state in
44+ command)
45+ _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
46+ ;;
47+
48 args)
49 case $words[1] in
50 bench)
51@@ -31,11 +45,10 @@ case $state in
52 '--no-default-features[do not build the default features]' \
53 '--no-run[compile but do not run]' \
54 '(-p,--package)'{-p=,--package=}'[package to run benchmarks for]:packages:_get_package_names' \
55- '--target=[target triple]: :_get_targets' \
56+ '--target=[target triple]' \
57 '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
58 '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
59- '--message-format=[error format]:format option:(human json)' \
60- '--color=[coloring]:colorization option:(auto always never)' \
61+ '--color=:colorization option:(auto always never)' \
62 ;;
63
64 build)
65@@ -49,11 +62,27 @@ case $state in
66 '--no-default-features[do not build the default features]' \
67 '(-p,--package)'{-p=,--package=}'[package to build]:packages:_get_package_names' \
68 '--release=[build in release mode]' \
69- '--target=[target triple]: :_get_targets' \
70+ '--target=[target triple]' \
71+ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
72+ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
73+ '--color=:colorization option:(auto always never)' \
74+ ;;
75+
76+ check)
77+ _arguments \
78+ '--features=[space separated feature list]' \
79+ '--all-features[enable all available features]' \
80+ '(-h, --help)'{-h,--help}'[show help message]' \
81+ '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
82+ "${command_scope_spec[@]}" \
83+ '--manifest-path=[path to manifest]: :_files -/' \
84+ '--no-default-features[do not check the default features]' \
85+ '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
86+ '--release=[check in release mode]' \
87+ '--target=[target triple]' \
88 '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
89 '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
90- '--message-format=[error format]:format option:(human json)' \
91- '--color=[coloring]:colorization option:(auto always never)' \
92+ '--color=:colorization option:(auto always never)' \
93 ;;
94
95 clean)
96@@ -63,9 +92,9 @@ case $state in
97 '(-p,--package)'{-p=,--package=}'[package to clean]:packages:_get_package_names' \
98 '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
99 '--release[whether or not to clean release artifacts]' \
100- '--target=[target triple(default:all)]: :_get_targets' \
101+ '--target=[target triple(default:all)]' \
102 '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
103- '--color=[coloring]:colorization option:(auto always never)' \
104+ '--color=:colorization option:(auto always never)' \