1#compdef piuparts
2
3local context state line
4typeset -A opt_args
5
6_arguments -s \
7	'(-a --apt)'{-a,--apt} \
8	'(-b --basetgz)'{-b,--basetgz=}':base tarball:_files' \
9	'(-d --distribution)'{-d,--distribution=}':Debian distribution:(sarge etch sid experimental)' \
10	'(-i --ignore)*'{-i,--ignore=}':file to ignore:_files' \
11	'(-I --ignore-regexp)*'{-I,--ignore-regexp=}':expression to ignore' \
12	'(-k --keep-tmpdir)'{-k,--keep-tmpdir} \
13	'(-l --log-file)'{-l,--logfile=}':log file:_files' \
14	'(-m --mirror)'{-m,--mirror=}':Debian mirror:_urls' \
15	'(-n --no-ignores)'{-n,--no-ignores} \
16	'(-p --pbuilder)'{-p,--pbuilder}'[use /var/cache/pbuilder/base.tgz]' \
17	'(-s --save)'{-s,--save=}':target tarball:_files' \
18	'(-t --tmpdir)'{-t,--tmpdir=}':temp dir:_files -/' \
19	'-V[version]' \
20	'*:package:->packages' && return 0
21
22case "$state" in
23    (packages)
24      if (( $+opt_args[-a] )); then
25          _deb_packages avail
26      else
27          _files -g '*.deb(-.)'
28      fi
29    ;;
30esac
31