8fba503667a477b544bfd1fa33e75430874e228a
- 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 54e709ca099928e7adc5467adf368020f3ef658e..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@@ -54,6 +68,23 @@ case $state in
52 '--color=:colorization option:(auto always never)' \
53 ;;
54
55+ check)
56+ _arguments \
57+ '--features=[space separated feature list]' \
58+ '--all-features[enable all available features]' \
59+ '(-h, --help)'{-h,--help}'[show help message]' \
60+ '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
61+ "${command_scope_spec[@]}" \
62+ '--manifest-path=[path to manifest]: :_files -/' \
63+ '--no-default-features[do not check the default features]' \
64+ '(-p,--package)'{-p=,--package=}'[package to check]:packages:_get_package_names' \
65+ '--release=[check in release mode]' \
66+ '--target=[target triple]' \
67+ '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
68+ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
69+ '--color=:colorization option:(auto always never)' \
70+ ;;
71+
72 clean)
73 _arguments \
74 '(-h, --help)'{-h,--help}'[show help message]' \
75@@ -105,7 +136,7 @@ case $state in
76 git-checkout)
77 _arguments \
78 '(-h, --help)'{-h,--help}'[show help message]' \
79- 'q(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
80+ '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
81 '--reference=[REF]' \
82 '--url=[URL]' \
83 '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
84@@ -142,10 +173,10 @@ case $state in
85 '(-h, --help)'{-h,--help}'[show help message]' \
86 '(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
87 '--no-default-features[do not build the default features]' \
88- '--path=[local filesystem path to crate to install]' \
89+ '--path=[local filesystem path to crate to install]: :_files -/' \
90 '(-q, --quiet)'{-q,--quiet}'[no output printed to stdout]' \
91 '--rev=[specific commit to use when installing from git]' \
92- '--root=[directory to install packages into]' \
93+ '--root=[directory to install packages into]: :_files -/' \
94 '--tag=[tag to use when installing from git]' \
95 '(-v, --verbose)'{-v,--verbose}'[use verbose output]' \
96 '--vers=[version to install from crates.io]' \
97@@ -270,7 +301,7 @@ case $state in
98 '--all-features[enable all available features]' \
99 '(-h, --help)'{-h,--help}'[show help message]' \
100 '(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
101- '--manifest-path=[path to the manifest to fetch dependencies for]' \
102+ '--manifest-path=[path to the manifest to fetch dependencies for]: :_files -/' \
103 '--no-default-features[do not compile default features for the package]' \
104 '(-p, --package)'{-p,--package}'=[profile to compile for]' \