#compdef hsh hsh-install hsh-run hsh-shell local curcontext="$curcontext" packages common_opts ret=1 __sisyphus_check_tests () { local expl tests tests=( 'buildhost' 'buildtime' 'changelog' 'content' 'deps' 'description' 'fhs' 'gpg' 'gpgname' 'group' 'intersects' 'libtool' 'locales' 'nvr' 'packager' 'perms' 'printable' 'summary' ) _wanted tests expl test compadd -a "$@" - tests } common_opts=( '--hasher-priv-dir=[hasher-priv directory]:hasher-priv:_directories' '--number=[subconfig identifier]:number' '--save-fakeroot[save fakeroot state]' '(-v --verbose -q --quiet)'{-q,--quiet}'[try to be more quiet]' '(-v --verbose -q --quiet)'{-v,--verbose}'[print a message for each action]' '(- :)'{-V,--version}'[print program version and exit]' '(- :)'{-h,--help}'[show usage and exit]' ) case "$service" in hsh) if (( $words[(I)--(initroot|cleanup)-only] )); then packages= else packages='*:package:_files -g "*.(rpm|tar)"' fi _arguments -S \ $common_opts \ '--apt-config=[path to custom apt.conf file]:apt-config:_files' \ '--apt-prefix=[path to apt directory prefix]:apt-prefix:_directories' \ '--build-args=[extra arguments for rpmbuild]:rpmbuild args:' \ '(--initroot-only)--cleanup-only[do not build at all, just cleanup workdir]' \ '--eager-cleanup[cleanup build environment after each successful build]' \ '--lazy-cleanup[cleanup build environment before each new build]' \ '--excludedocs[do not install documentation files]' \ '(--cleanup-only)--initroot-only[do not build, stop after initroot stage]' \ '--install-langs=[colon-separated list of languages to install]:languages' \ '--mountpoints=[comma-separated list of known mount points]:mountpoints' \ '--no-cache[do not use initroot cache]' \ '--no-contents-indices[do not use content indices]' \ '(--repackage-source)--no-repackage-source[do not repackage source along with binaries]' \ '--no-sisyphus-check-in=[do not run sisyphus_check input tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \ '--no-sisyphus-check=[do not run sisyphus_check tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \ '--no-sisyphus-check-out=[do not run sisyphus_check output tests]::sisyphus_check tests:__sisyphus_check_tests -S, -q' \ '--nprocs=[number of CPUs to use]:number' \ '--pkg-build-list=[override default build package file list]:packages' \ '--pkg-init-list=[override default initial package file list]:packages' \ '(--query-req-prog)--query-repackage[repackage the source before query for requirements]' \ '(--query-repackage)--query-req-prog=[program to run to query for requirements]:query-req-prog:_files' \ '(--no-repackage-source)--repackage-source[repackage source along with binaries]' \ '--repo=[repository directory]:repository directory' \ '--target=[target architecture]:architecture' \ '(--with-stuff)--without-stuff[do not use built packages]' \ '(--without-stuff)--with-stuff[allow use of built packages]' \ ':workdir:_directories' \ $packages && ret=0 ;; hsh-install) _arguments -S \ $common_opts \ '--excludedocs[do not install documentation files]' \ ':workdir:_directories' \ '*:package' && ret=0 ;; hsh-run|hsh-shell) _arguments -S \ $common_opts \ '--builder[run program as builder]' \ '--execute=[copy given script to workdir and execute it]:script:_files' \ '--mountpoints=[comma-separated list of known mount points]:mountpoints' \ '--pty[redirect standard descriptors to controlling pty]' \ '--rooter=[run program as pseudoroot]' \ '--shell=[run interactive shell]::shell:_files' \ '--x11-timeout=[how long X11 authorization will be valid]:seconds' \ '(-x -X -Y)-x[disable X11 forwarding]' \ '(-x -X -Y)-X[enable X11 forwarding]' \ '(-x -X -Y)-Y[enable trusted X11 forwarding]' \ ':workdir:_directories' \ '(-):command name: _command_names -e' \ '*::arguments: _normal' && ret=0 ;; esac