#compdef rsopv

autoload -U is-at-least

_rsopv() {
    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[@]}" : \
'--debug[Emit verbose output for debugging]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_rsopv_commands" \
"*::: :->sop" \
&& ret=0
    case $state in
    (sop)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rsopv-command-$line[1]:"
        case $line[1] in
            (version)
_arguments "${_arguments_options[@]}" : \
'(--extended --sop-spec --sopv)--backend[Returns name and version of the primary underlying OpenPGP toolkit]' \
'(--backend --sop-spec --sopv)--extended[Returns multiple lines of name and version information]' \
'(--backend --extended --sopv)--sop-spec[Returns the latest version of the SOP spec that is implemented]' \
'(--backend --extended --sop-spec)--sopv[Returns "1.0\\n" if the sopv subset is implemented]' \
'--debug[Emit verbose output for debugging]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(verify)
_arguments "${_arguments_options[@]}" : \
'--not-before=[Consider signatures before this date invalid]:NOT_BEFORE:_default' \
'--not-after=[Consider signatures after this date invalid]:NOT_AFTER:_default' \
'--debug[Emit verbose output for debugging]' \
'-h[Print help]' \
'--help[Print help]' \
':signatures -- Signatures to verify:_default' \
'*::certs -- Certs for verification:_default' \
&& ret=0
;;
(inline-verify)
_arguments "${_arguments_options[@]}" : \
'--not-before=[Consider signatures before this date invalid]:NOT_BEFORE:_default' \
'--not-after=[Consider signatures after this date invalid]:NOT_AFTER:_default' \
'--verifications-out=[Write verification result here]:VERIFICATIONS_OUT:_default' \
'--debug[Emit verbose output for debugging]' \
'-h[Print help]' \
'--help[Print help]' \
'*::certs -- Certs for verification:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_rsopv__help_commands" \
"*::: :->help" \
&& ret=0

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

(( $+functions[_rsopv_commands] )) ||
_rsopv_commands() {
    local commands; commands=(
'version:Prints version information' \
'verify:Verifies Detached Signatures' \
'inline-verify:Verifies Inline-Signed Messages' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rsopv commands' commands "$@"
}
(( $+functions[_rsopv__help_commands] )) ||
_rsopv__help_commands() {
    local commands; commands=(
'version:Prints version information' \
'verify:Verifies Detached Signatures' \
'inline-verify:Verifies Inline-Signed Messages' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rsopv help commands' commands "$@"
}
(( $+functions[_rsopv__help__help_commands] )) ||
_rsopv__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv help help commands' commands "$@"
}
(( $+functions[_rsopv__help__inline-verify_commands] )) ||
_rsopv__help__inline-verify_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv help inline-verify commands' commands "$@"
}
(( $+functions[_rsopv__help__verify_commands] )) ||
_rsopv__help__verify_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv help verify commands' commands "$@"
}
(( $+functions[_rsopv__help__version_commands] )) ||
_rsopv__help__version_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv help version commands' commands "$@"
}
(( $+functions[_rsopv__inline-verify_commands] )) ||
_rsopv__inline-verify_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv inline-verify commands' commands "$@"
}
(( $+functions[_rsopv__verify_commands] )) ||
_rsopv__verify_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv verify commands' commands "$@"
}
(( $+functions[_rsopv__version_commands] )) ||
_rsopv__version_commands() {
    local commands; commands=()
    _describe -t commands 'rsopv version commands' commands "$@"
}

if [ "$funcstack[1]" = "_rsopv" ]; then
    _rsopv "$@"
else
    compdef _rsopv rsopv
fi
