@@ -8,9 +8,12 @@ _cargo()
88
99 cmd=${words[1]}
1010
11- local commands= $( cargo --list | tail -n +2 )
11+ local vcs= ' git hg none '
1212
13- local opt_common=' -h --help -v --verbose'
13+ local opt_help=' -h --help'
14+ local opt_verbose=' -v --verbose'
15+ local opt_quiet=' -q --quiet'
16+ local opt_common=" $opt_help $opt_verbose $opt_quiet "
1417 local opt_pkg=' -p --package'
1518 local opt_feat=' --features --no-default-features'
1619 local opt_mani=' --manifest-path'
@@ -30,33 +33,36 @@ _cargo()
3033 local opt__owner=" $opt_common -a --add -r --remove -l --list --index --token"
3134 local opt__pkgid=" ${opt__fetch} "
3235 local opt__publish=" $opt_common $opt_mani --host --token --no-verify"
33- local opt__read_manifest=" ${opt__fetch} "
36+ local opt__read_manifest=" $opt_help $opt_verbose $opt_mani "
3437 local opt__run=" $opt_common $opt_feat $opt_mani $opt_jobs --target --bin --example --release"
3538 local opt__rustc=" $opt_common $opt_pkg $opt_feat $opt_mani $opt_jobs --target --lib --bin --test --bench --example --release"
3639 local opt__search=" $opt_common --host"
3740 local opt__test=" $opt_common $opt_pkg $opt_feat $opt_mani $opt_jobs --target --lib --bin --test --bench --example --no-run --release"
3841 local opt__update=" $opt_common $opt_pkg $opt_mani --aggressive --precise"
3942 local opt__package=" $opt_common $opt_mani -l --list --no-verify --no-metadata"
4043 local opt__verify_project=" ${opt__fetch} "
41- local opt__version=" $opt_common "
44+ local opt__version=" $opt_help $opt_verbose "
4245 local opt__yank=" $opt_common --vers --undo --index --token"
4346
4447 if [[ $cword -eq 1 ]]; then
4548 if [[ " $cur " == -* ]]; then
4649 COMPREPLY=( $( compgen -W " ${opt___nocmd} " -- " $cur " ) )
4750 else
48- COMPREPLY=( $( compgen -W " $commands " -- " $cur " ) )
51+ COMPREPLY=( $( compgen -W " $__cargo_commands " -- " $cur " ) )
4952 fi
5053 elif [[ $cword -ge 2 ]]; then
5154 case " ${prev} " in
55+ --vcs)
56+ COMPREPLY=( $( compgen -W " $vcs " -- " $cur " ) )
57+ ;;
5258 --manifest-path)
5359 _filedir toml
5460 ;;
5561 --example)
5662 COMPREPLY=( $( compgen -W " $( _get_examples) " -- " $cur " ) )
5763 ;;
5864 help)
59- COMPREPLY=( $( compgen -W " $commands " -- " $cur " ) )
65+ COMPREPLY=( $( compgen -W " $__cargo_commands " -- " $cur " ) )
6066 ;;
6167 * )
6268 local opt_var=opt__${cmd// -/ _}
@@ -71,6 +77,8 @@ _cargo()
7177} &&
7278complete -F _cargo cargo
7379
80+ __cargo_commands=$( cargo --list | tail -n +2)
81+
7482_locate_manifest (){
7583 local manifest=` cargo locate-project 2> /dev/null`
7684 # regexp-replace manifest '\{"root":"|"\}' ''
0 commit comments