#compdef ssh-openpgp-auth

autoload -U is-at-least

_ssh-openpgp-auth() {
    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[@]}" \
'-h[Print help]' \
'--help[Print help]' \
":: :_ssh-openpgp-auth_commands" \
"*::: :->ssh-openpgp-auth" \
&& ret=0
    case $state in
    (ssh-openpgp-auth)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:ssh-openpgp-auth-command-$line[1]:"
        case $line[1] in
            (authenticate)
_arguments "${_arguments_options[@]}" \
'-t+[Certificate time. By default now. Example\: 2021-11-21T11\:11\:11Z]:TIME: ' \
'--time=[Certificate time. By default now. Example\: 2021-11-21T11\:11\:11Z]:TIME: ' \
'-c+[Certificate store. By default uses user'\''s shared PGP certificate directory]:CERT_STORE:_files' \
'--cert-store=[Certificate store. By default uses user'\''s shared PGP certificate directory]:CERT_STORE:_files' \
'--nameserver=[Nameserver to use for DNS lookups (if enabled)]:NAMESERVER: ' \
'--verify-dns-proof[Verify Keyoxide DNS proofs of certificates]' \
'--verify-wot[Verify the certificates using local Web of Trust network]' \
'--verbose[Print details of the verification process. Useful for debugging]' \
'--store-verifications[Store verification results in the OpenPGP certificate]' \
'-h[Print help]' \
'--help[Print help]' \
':host -- Target host to authenticate. This should be a DNS name:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_ssh-openpgp-auth__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:ssh-openpgp-auth-help-command-$line[1]:"
        case $line[1] in
            (authenticate)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_ssh-openpgp-auth_commands] )) ||
_ssh-openpgp-auth_commands() {
    local commands; commands=(
'authenticate:Fetches OpenPGP host certificates, verifies it and prints host keys in SSH format on successful verification' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'ssh-openpgp-auth commands' commands "$@"
}
(( $+functions[_ssh-openpgp-auth__authenticate_commands] )) ||
_ssh-openpgp-auth__authenticate_commands() {
    local commands; commands=()
    _describe -t commands 'ssh-openpgp-auth authenticate commands' commands "$@"
}
(( $+functions[_ssh-openpgp-auth__help__authenticate_commands] )) ||
_ssh-openpgp-auth__help__authenticate_commands() {
    local commands; commands=()
    _describe -t commands 'ssh-openpgp-auth help authenticate commands' commands "$@"
}
(( $+functions[_ssh-openpgp-auth__help_commands] )) ||
_ssh-openpgp-auth__help_commands() {
    local commands; commands=(
'authenticate:Fetches OpenPGP host certificates, verifies it and prints host keys in SSH format on successful verification' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'ssh-openpgp-auth help commands' commands "$@"
}
(( $+functions[_ssh-openpgp-auth__help__help_commands] )) ||
_ssh-openpgp-auth__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'ssh-openpgp-auth help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_ssh-openpgp-auth" ]; then
    _ssh-openpgp-auth "$@"
else
    compdef _ssh-openpgp-auth ssh-openpgp-auth
fi
