summaryrefslogtreecommitdiff
path: root/etc/completions/_pkg
blob: 9845186e52e89cb4a3db1b535720a4a354743b6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#compdef pkg
## vim:ft=zsh

local arguments_action arguments_list arguments_listall
local all installed

all=(pkg list-all)
installed=(pkg list)

arguments_action=(
	'1:action:(add install changelog changeroot delete remove info list list-all local-update log remote-update status update upgrade)'
)
arguments_list=(
	'2:package:($($installed))'
)
arguments_listall=(
	'2:package:($($all))'
)

if [[ $CURRENT -ge 3 ]] {
	case ${words[2]} in
		changelog|delete|remove|status|upgrade) _arguments -s $arguments_list ;;
		add|info|install) _arguments -s $arguments_listall ;;
	esac
} else {
	_arguments -s $arguments_action
}