#compdef pinnacle

autoload -U is-at-least

_pinnacle() {
    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[@]}" : \
'-c+[Use the config at the given directory]:DIR:_files -/' \
'--config-dir=[Use the config at the given directory]:DIR:_files -/' \
'-s+[Open the gRPC socket at the specified directory]:DIR:_files -/' \
'--socket-dir=[Open the gRPC socket at the specified directory]:DIR:_files -/' \
'--allow-root[Allow running Pinnacle as root (this is NOT recommended)]' \
'--no-config[Start Pinnacle without a config]' \
'--no-xwayland[Prevent Xwayland from being started]' \
'--session[Start Pinnacle as a session]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_pinnacle_commands" \
"*::: :->pinnacle" \
&& ret=0
    case $state in
    (pinnacle)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-command-$line[1]:"
        case $line[1] in
            (config)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_pinnacle__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-config-command-$line[1]:"
        case $line[1] in
            (gen)
_arguments "${_arguments_options[@]}" : \
'-l+[Generate a config in a specific language]:LANG:((lua\:"Generate a Lua config"
rust\:"Generate a Rust config"))' \
'--lang=[Generate a config in a specific language]:LANG:((lua\:"Generate a Lua config"
rust\:"Generate a Rust config"))' \
'-d+[Generate a config at the given directory]:DIR:_files -/' \
'--dir=[Generate a config at the given directory]:DIR:_files -/' \
'-n[Do not show interactive prompts if both \`--lang\` and \`--dir\` are set]' \
'--non-interactive[Do not show interactive prompts if both \`--lang\` and \`--dir\` are set]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_pinnacle__config__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-config-help-command-$line[1]:"
        case $line[1] in
            (gen)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(debug)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_pinnacle__debug_commands" \
"*::: :->debug" \
&& ret=0

    case $state in
    (debug)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-debug-command-$line[1]:"
        case $line[1] in
            (panic)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_pinnacle__debug__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-debug-help-command-$line[1]:"
        case $line[1] in
            (panic)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(gen-completions)
_arguments "${_arguments_options[@]}" : \
'-s+[]:SHELL:(bash elvish fish powershell zsh)' \
'--shell=[]:SHELL:(bash elvish fish powershell zsh)' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(client)
_arguments "${_arguments_options[@]}" : \
'-e+[Execute the provided Lua string]:EXECUTE:_default' \
'--execute=[Execute the provided Lua string]:EXECUTE:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_pinnacle__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-help-command-$line[1]:"
        case $line[1] in
            (config)
_arguments "${_arguments_options[@]}" : \
":: :_pinnacle__help__config_commands" \
"*::: :->config" \
&& ret=0

    case $state in
    (config)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-help-config-command-$line[1]:"
        case $line[1] in
            (gen)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(debug)
_arguments "${_arguments_options[@]}" : \
":: :_pinnacle__help__debug_commands" \
"*::: :->debug" \
&& ret=0

    case $state in
    (debug)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pinnacle-help-debug-command-$line[1]:"
        case $line[1] in
            (panic)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(gen-completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(client)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_pinnacle_commands] )) ||
_pinnacle_commands() {
    local commands; commands=(
'config:Commands dealing with configuration' \
'debug:Commands for debugging' \
'gen-completions:Generate shell completions and print them to stdout' \
'client:Start an interactive Lua REPL with the Pinnacle API loaded' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle commands' commands "$@"
}
(( $+functions[_pinnacle__client_commands] )) ||
_pinnacle__client_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle client commands' commands "$@"
}
(( $+functions[_pinnacle__config_commands] )) ||
_pinnacle__config_commands() {
    local commands; commands=(
'gen:Generate a config' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle config commands' commands "$@"
}
(( $+functions[_pinnacle__config__gen_commands] )) ||
_pinnacle__config__gen_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle config gen commands' commands "$@"
}
(( $+functions[_pinnacle__config__help_commands] )) ||
_pinnacle__config__help_commands() {
    local commands; commands=(
'gen:Generate a config' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle config help commands' commands "$@"
}
(( $+functions[_pinnacle__config__help__gen_commands] )) ||
_pinnacle__config__help__gen_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle config help gen commands' commands "$@"
}
(( $+functions[_pinnacle__config__help__help_commands] )) ||
_pinnacle__config__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle config help help commands' commands "$@"
}
(( $+functions[_pinnacle__debug_commands] )) ||
_pinnacle__debug_commands() {
    local commands; commands=(
'panic:' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle debug commands' commands "$@"
}
(( $+functions[_pinnacle__debug__help_commands] )) ||
_pinnacle__debug__help_commands() {
    local commands; commands=(
'panic:' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle debug help commands' commands "$@"
}
(( $+functions[_pinnacle__debug__help__help_commands] )) ||
_pinnacle__debug__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle debug help help commands' commands "$@"
}
(( $+functions[_pinnacle__debug__help__panic_commands] )) ||
_pinnacle__debug__help__panic_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle debug help panic commands' commands "$@"
}
(( $+functions[_pinnacle__debug__panic_commands] )) ||
_pinnacle__debug__panic_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle debug panic commands' commands "$@"
}
(( $+functions[_pinnacle__gen-completions_commands] )) ||
_pinnacle__gen-completions_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle gen-completions commands' commands "$@"
}
(( $+functions[_pinnacle__help_commands] )) ||
_pinnacle__help_commands() {
    local commands; commands=(
'config:Commands dealing with configuration' \
'debug:Commands for debugging' \
'gen-completions:Generate shell completions and print them to stdout' \
'client:Start an interactive Lua REPL with the Pinnacle API loaded' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pinnacle help commands' commands "$@"
}
(( $+functions[_pinnacle__help__client_commands] )) ||
_pinnacle__help__client_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle help client commands' commands "$@"
}
(( $+functions[_pinnacle__help__config_commands] )) ||
_pinnacle__help__config_commands() {
    local commands; commands=(
'gen:Generate a config' \
    )
    _describe -t commands 'pinnacle help config commands' commands "$@"
}
(( $+functions[_pinnacle__help__config__gen_commands] )) ||
_pinnacle__help__config__gen_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle help config gen commands' commands "$@"
}
(( $+functions[_pinnacle__help__debug_commands] )) ||
_pinnacle__help__debug_commands() {
    local commands; commands=(
'panic:' \
    )
    _describe -t commands 'pinnacle help debug commands' commands "$@"
}
(( $+functions[_pinnacle__help__debug__panic_commands] )) ||
_pinnacle__help__debug__panic_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle help debug panic commands' commands "$@"
}
(( $+functions[_pinnacle__help__gen-completions_commands] )) ||
_pinnacle__help__gen-completions_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle help gen-completions commands' commands "$@"
}
(( $+functions[_pinnacle__help__help_commands] )) ||
_pinnacle__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'pinnacle help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_pinnacle" ]; then
    _pinnacle "$@"
else
    compdef _pinnacle pinnacle
fi
