1#compdef axi-cache
2
3local expl
4
5_arguments \
6  '--version[version]' \
7  '(-h --help)'{-h,--help}'[help]' \
8  '(-s --sort)'{-s,--sort=}':sort value:('${(j: :)${${(M)${(f)"$(</var/lib/apt-xapian-index/values)"}:#[a-z]*}%%	*}}')' \
9  '--tags[show tags, not packages]' \
10  '*:args:->args' && return 0
11
12if (( CURRENT == 2 )); then
13  _wanted tag expl 'axi-cache commands' \
14    compadd help search more last show again
15else
16  case "$words[2]" in
17    (search|show|again)
18      _wanted tag expl 'terms/query' \
19        compadd -- $($service $words[2] --tabcomplete=plain -- $words[CURRENT])
20    ;;
21    (more|last)
22      _wanted tag expl 'count' \
23        compadd -- 1 2 3 4 5 6 7 8 9 0
24    ;;
25    (*)
26      _files
27    ;;
28    esac
29fi
30