File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33typeset -A opt_args
44autoload -U regexp-replace
55
6+ zstyle -T ':completion:*:*:cargo:*' tag-order && \
7+ zstyle ':completion:*:*:cargo:*' tag-order 'common-commands'
8+
69_cargo() {
710
811_arguments \
@@ -11,10 +14,14 @@ _arguments \
1114 '(- 1 *)'{-v,--verbose}'[use verbose output]' \
1215 '(- 1 *)'--color'[colorization option]' \
1316 '(- 1 *)'{-V,--version}'[show version information]' \
14- '1: :_cargo_cmds ' \
17+ '1: :->command ' \
1518 '*:: :->args'
1619
1720case $state in
21+ command)
22+ _alternative 'common-commands:common:_cargo_cmds' 'all-commands:all:_cargo_all_cmds'
23+ ;;
24+
1825 args)
1926 case $words[1] in
2027 bench)
@@ -431,8 +438,12 @@ local -a commands;commands=(
431438'version:show version information'
432439'yank:remove pushed file from index'
433440)
434- _describe 'command' commands
441+ _describe -t common-commands 'common commands' commands
442+ }
435443
444+ _cargo_all_cmds(){
445+ local -a commands;commands=($(cargo --list))
446+ _describe -t all-commands 'all commands' commands
436447}
437448
438449
You can’t perform that action at this time.
0 commit comments