#compdef sisyphus_check

local curcontext="$curcontext" context state line ret=1

local -a opts_help
opts_help=(
    '(-v --verbose -q --quiet)'{-q,--quiet}'[try to be more quiet]'
    '(-v --verbose -q --quiet)'{-v,--verbose}'[print a message for each action]'
    '(- :)'{-h,--help}'[show usage and exit]'
)

local -a args
args=('*:directory:_directories')
if (( $words[(I)--files] )); then
    args=('*:package:_files -g "*.rpm"')
fi

_arguments -S \
    $opts_help \
    '--fast-check[stop checking after first error]' \
    '(--files --directories)--files[treat <target> as a packages]' \
    '(--files --directories)--directories[treat <target> as a directory]' \
    '--recursive[search packages recursively]' \
    '--show-bad-files[print bad packages]' \
    '--trust-gpg-names=[change the list of trusted gpg names]::' \
    '--'{no-,}'check=[change the list of checks]::sisyphus_check tests:_sisyphus_check_tests' \
    $args && ret=0

return $ret
