#compdef signstar-request-signature

autoload -U is-at-least

_signstar-request-signature() {
    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[@]}" : \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_signstar-request-signature_commands" \
"*::: :->signstar-request-signature" \
&& ret=0
    case $state in
    (signstar-request-signature)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:signstar-request-signature-command-$line[1]:"
        case $line[1] in
            (prepare)
_arguments "${_arguments_options[@]}" : \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
':input -- The path to a file being signed:_files' \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
'--host=[Signstar host]:HOST:_default' \
'--port=[Signstar port]:PORT:_default' \
'--user=[Signstar user]:USER:_default' \
'--agent-socket=[Path to the agent socket used for user authentication]:AGENT_SOCKET:_files' \
'--user-public-key=[Public key of a user]:USER_PUBLIC_KEY:_default' \
'--known-hosts=[Path of a known hosts file which contains public keys of the serevr]:KNOWN_HOSTS:_files' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
':input -- The path to a file being signed:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_signstar-request-signature__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:signstar-request-signature-help-command-$line[1]:"
        case $line[1] in
            (prepare)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(send)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_signstar-request-signature_commands] )) ||
_signstar-request-signature_commands() {
    local commands; commands=(
'prepare:Prepare signing request for a file' \
'send:Send signing request over SSH' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'signstar-request-signature commands' commands "$@"
}
(( $+functions[_signstar-request-signature__help_commands] )) ||
_signstar-request-signature__help_commands() {
    local commands; commands=(
'prepare:Prepare signing request for a file' \
'send:Send signing request over SSH' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'signstar-request-signature help commands' commands "$@"
}
(( $+functions[_signstar-request-signature__help__help_commands] )) ||
_signstar-request-signature__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-request-signature help help commands' commands "$@"
}
(( $+functions[_signstar-request-signature__help__prepare_commands] )) ||
_signstar-request-signature__help__prepare_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-request-signature help prepare commands' commands "$@"
}
(( $+functions[_signstar-request-signature__help__send_commands] )) ||
_signstar-request-signature__help__send_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-request-signature help send commands' commands "$@"
}
(( $+functions[_signstar-request-signature__prepare_commands] )) ||
_signstar-request-signature__prepare_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-request-signature prepare commands' commands "$@"
}
(( $+functions[_signstar-request-signature__send_commands] )) ||
_signstar-request-signature__send_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-request-signature send commands' commands "$@"
}

if [ "$funcstack[1]" = "_signstar-request-signature" ]; then
    _signstar-request-signature "$@"
else
    compdef _signstar-request-signature signstar-request-signature
fi
