#compdef paccat

autoload -U is-at-least

_paccat() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'-r+[Set an alternative root directory]:path: ' \
'--root=[Set an alternative root directory]:path: ' \
'-b+[Set an alternative database location]:path: ' \
'--dbpath=[Set an alternative database location]:path: ' \
'--config=[Use an alternative pacman.conf]:file: ' \
'--cachedir=[Set an alternative cache directory]:path: ' \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'-x[Enable searching using regular expressions]' \
'--regex[Enable searching using regular expressions]' \
'-a[print all matches of files instead of just the first]' \
'--all[print all matches of files instead of just the first]' \
'-e[Extract matched files to the current directory]' \
'--extract[Extract matched files to the current directory]' \
'-q[Print file names instead of file content]' \
'--quiet[Print file names instead of file content]' \
'--binary[Print binary files]' \
'-F[Use files database to search for files before deciding to download]' \
'--files[Use files database to search for files before deciding to download]' \
'(-F --files)-Q[Use local database to search for files before deciding to download]' \
'(-F --files)--query[Use local database to search for files before deciding to download]' \
'*::targets -- List of packages, package files, or package urls:' \
'*::file -- Files to search for:' \
&& ret=0
}

(( $+functions[_paccat_commands] )) ||
_paccat_commands() {
    local commands; commands=()
    _describe -t commands 'paccat commands' commands "$@"
}

_paccat "$@"