1#compdef dchroot
2
3local expl context state line
4typeset -A opt_args
5
6_arguments -S \
7       '(-h --help)'{-h,--help}'[help]' \
8       '(-a --all)'{-a,--all}'[select all chroots]' \
9       '*'{-c,--chroot=}'[use specified chroot]:chroot:->chroot' \
10       '(-d --directory)'{-d,--directory=}'[directory to use]:dir:_files -W / -P /' \
11       '(-l --list)'{-l,--list}'[list available chroots]' \
12       '(-i --info)'{-i,--info}'[show information about selected chroots]' \
13       '(-p --path)'{-p,--path}'[print path to selected chroot]' \
14       '--config[dump configuration of selected chroots]' \
15       '(-d --preserve-environment)'{-d,--preserve-environment}'[preserve user environment]' \
16       '(-q --quiet)'{-q,--quiet}'[quiet]' \
17       '(-v --verbose)'{-v,--verbose}'[verbose]' \
18       '(-V --version)'{-V,--version}'[version]' \
19       '(-):command name: _command_names -e' \
20       '*::arguments: _normal' && return 0
21
22case "$state" in
23	(chroot)
24	_wanted tag expl 'chroot' \
25	compadd ${(os:,:)${${${"$(dchroot -l )"#*: }// /}//[[\]]/,}}
26	;;
27esac
28