#compdef gpg-sq

autoload -U is-at-least

_gpg-sq() {
    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[@]}" : \
'-s+[make a signature]: :_default' \
'--sign=[make a signature]: :_default' \
'--clear-sign=[make a clear text signature]: :_default' \
'-b+[make a detached signature]: :_default' \
'--detach-sign=[make a detached signature]: :_default' \
'-e+[encrypt data]: :_default' \
'--encrypt=[encrypt data]: :_default' \
'-c+[encryption only with symmetric cipher]: :_default' \
'--symmetric=[encryption only with symmetric cipher]: :_default' \
'-d+[decrypt data (default)]: :_default' \
'--decrypt=[decrypt data (default)]: :_default' \
'--verify=[verify a signature]: :_default' \
'-k+[list keys]: :_default' \
'--list-keys=[list keys]: :_default' \
'--list-signatures=[list keys and signatures]: :_default' \
'--check-signatures=[list and check key signatures]: :_default' \
'--fingerprint=[list keys and fingerprints]: :_default' \
'-K+[list secret keys]: :_default' \
'--list-secret-keys=[list secret keys]: :_default' \
'--generate-key=[generate a new key pair]: :_default' \
'--quick-generate-key=[quickly generate a new key pair]: :_default' \
'--quick-add-uid=[quickly add a new user-id]: :_default' \
'--quick-revoke-uid=[quickly revoke a user-id]: :_default' \
'--quick-set-expire=[quickly set a new expiration date]: :_default' \
'--full-generate-key=[full featured key pair generation]: :_default' \
'--generate-revocation=[generate a revocation certificate]: :_default' \
'--delete-keys=[remove keys from the public keyring]: :_default' \
'--delete-secret-keys=[remove keys from the secret keyring]: :_default' \
'--quick-sign-key=[quickly sign a key]: :_default' \
'--quick-lsign-key=[quickly sign a key locally]: :_default' \
'--quick-revoke-sig=[quickly revoke a key signature]: :_default' \
'--sign-key=[sign a key]: :_default' \
'--lsign-key=[sign a key locally]: :_default' \
'--edit-key=[sign or edit a key]: :_default' \
'--change-passphrase=[change a passphrase]: :_default' \
'--export=[export keys]: :_default' \
'--send-keys=[export keys to a keyserver]: :_default' \
'--receive-keys=[import keys from a keyserver]: :_default' \
'--search-keys=[search for keys on a keyserver]: :_default' \
'--refresh-keys=[update all keys from a keyserver]: :_default' \
'--import=[import/merge keys]: :_default' \
'--update-trustdb=[update the trust database]: :_default' \
'--print-md=[print message digests]: :_default' \
'--server=[run in server mode]: :_default' \
'--tofu-policy=[set the TOFU policy for a key]:VALUE:_default' \
'--x-sequoia-parcimonie=[continuously update certificates]: :_default' \
'-v+[verbose]: :_default' \
'--verbose=[verbose]: :_default' \
'-q+[be somewhat more quiet]: :_default' \
'--quiet=[be somewhat more quiet]: :_default' \
'--options=[read options from FILE]:FILE:_default' \
'--log-file=[write server mode logs to FILE]:FILE:_default' \
'--default-key=[use NAME as default secret key]:NAME:_default' \
'--encrypt-to=[encrypt to user ID NAME as well]:NAME:_default' \
'--group=[set up email aliases]:SPEC:_default' \
'--openpgp=[use strict OpenPGP behavior]: :_default' \
'-n+[do not make any changes]: :_default' \
'--dry-run=[do not make any changes]: :_default' \
'-i+[prompt before overwriting]: :_default' \
'--interactive=[prompt before overwriting]: :_default' \
'-a+[create ascii armored output]: :_default' \
'--armor=[create ascii armored output]: :_default' \
'-o+[write output to FILE]:FILE:_default' \
'--output=[write output to FILE]:FILE:_default' \
'--textmode=[use canonical text mode]: :_default' \
'-z+[set compress level to N (0 disables)]:N:_default' \
'--auto-key-locate=[use MECHANISMS to locate keys by mail address]:MECHANISMS:_default' \
'--auto-key-import=[import missing key from a signature]: :_default' \
'--include-key-block=[include the public key in signatures]: :_default' \
'--disable-dirmngr=[disable all access to the dirmngr]: :_default' \
'-r+[encrypt for USER-ID]:USER-ID:_default' \
'--recipient=[encrypt for USER-ID]:USER-ID:_default' \
'-u+[use USER-ID to sign or decrypt]:USER-ID:_default' \
'--local-user=[use USER-ID to sign or decrypt]:USER-ID:_default' \
'--x-sequoia-autostart-parcimonie=[automatically start daemon to update certs]: :_default' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'*::args -- Additional arguments.  The semantics of the additional arguments, and if there are any, and how many, is dependent on the selected command.:_default' \
&& ret=0
}

(( $+functions[_gpg-sq_commands] )) ||
_gpg-sq_commands() {
    local commands; commands=()
    _describe -t commands 'gpg-sq commands' commands "$@"
}

if [ "$funcstack[1]" = "_gpg-sq" ]; then
    _gpg-sq "$@"
else
    compdef _gpg-sq gpg-sq
fi
