#compdef signstar-client

autoload -U is-at-least

_signstar-client() {
    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-client_commands" \
"*::: :->signstar-client" \
&& ret=0
    case $state in
    (signstar-client)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:signstar-client-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[@]}" : \
'--config=[Configuration file to use]:CONFIG:_files' \
'--user=[The user to use for connecting]:USER:_default' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':input -- The path to a file being signed:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_signstar-client__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:signstar-client-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-client_commands] )) ||
_signstar-client_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-client commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__help_commands] )) ||
_signstar-client__subcmd__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-client help commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__help__subcmd__help_commands] )) ||
_signstar-client__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-client help help commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__help__subcmd__prepare_commands] )) ||
_signstar-client__subcmd__help__subcmd__prepare_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-client help prepare commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__help__subcmd__send_commands] )) ||
_signstar-client__subcmd__help__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-client help send commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__prepare_commands] )) ||
_signstar-client__subcmd__prepare_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-client prepare commands' commands "$@"
}
(( $+functions[_signstar-client__subcmd__send_commands] )) ||
_signstar-client__subcmd__send_commands() {
    local commands; commands=()
    _describe -t commands 'signstar-client send commands' commands "$@"
}

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