Skip to content

Commit

Permalink
zsh completions
Browse files Browse the repository at this point in the history
  • Loading branch information
heisen-li committed Dec 20, 2023
1 parent 3e1914e commit 6d2b554
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/etc/_cargo
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ _cargo() {
'--allow-dirty[fix code even if the working directory is dirty]' \
'--allow-staged[fix code even if the working directory has staged changes]' \
'--ignore-rust-version[Ignore rust-version specification in packages]'
;;

;;
generate-lockfile)
_arguments -s -S $common $manifest
;;
Expand Down Expand Up @@ -218,9 +217,11 @@ _cargo() {
_arguments -s -S $common $registry \
'(-a --add)'{-a,--add}'[specify name of a user or team to invite as an owner]:name' \
'--index=[specify registry index]:index' \
'--crate=[Crate name that you want to manage the owner]:crate' \
'(-l --list)'{-l,--list}'[list owners of a crate]' \
'(-r --remove)'{-r,--remove}'[specify name of a user or team to remove as an owner]:name' \
'--token=[specify API token to use when authenticating]:token' \
'(--add -a --remove -r --list -l 1): :_cargo_owner_subcommand' \
'*: :_guard "^-*" "crate"'
;;

Expand Down Expand Up @@ -378,6 +379,17 @@ _cargo() {
esac
}

_cargo_owner_subcommand() {
local -a subcommands

subcommands=(
'add:specify name of a user or team to invite as an owner'
'remove:specify name of a user or team to remove as an owner'
'list:list owners of a crate'
)
_describe -t subcommands 'command' subcommands
}

_cargo_unstable_flags() {
local flags
flags=( help ${${${(M)${(f)"$(_call_program flags cargo -Z help)"}:#*--*}/ #-- #/:}##*-Z } )
Expand Down

0 comments on commit 6d2b554

Please sign in to comment.