summaryrefslogtreecommitdiff
path: root/provides/zsh/completions/_apt-why
blob: 20c39bb37a66dad50caa38ffab95c4197f4fc9b7 (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
28
#compdef apt-why
## Completion for apt-why
## Daniel Friesel <derf@derf.homelinux.org>
## https://derf.homelinux.org/~derf/dotfiles/completion/_apt-why
## see also: https://derf.homelinux.org/~derf/code/apt-why

typeset -a arguments

function _apt-why_deptype {
	typeset prefix=''
	typeset -a keys used_prefixes
	keys=(Depends Recommends Suggests)
	if [[ -prefix *, ]] {
		prefix=${words[$CURRENT]%,*},
		used_prefixes=(${(s:,:)prefix})
	}
	_wanted expression expl 'dependency type' \
	compadd -F used_prefixes -qS , -P "$prefix" $keys
}

arguments=(
	'--all[consider all available packages]'
	'--depth=-[recursion depth]:recursion depth'
	'--deptype[filter by dependency type]:dependency type:_apt-why_deptype'
	'*:package:_deb_packages "" avail'
)

_arguments -s $arguments