summaryrefslogtreecommitdiff
path: root/provides/zsh/completions/_apt-why
blob: e4d1cbe8b107305ec6423a6b37c2916eb56377ef (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@finalrewind.org>
## https://finalrewind.org/~derf/dotfiles/completion/_apt-why
## see also: https://finalrewind.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