#compdef zellij

autoload -U is-at-least

_zellij() {
    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[@]}" \
'--max-panes=[Maximum panes on screen, caution: opening more panes will close old ones]' \
'--data-dir=[Change where zellij looks for layouts and plugins]' \
'-l+[Path to a layout yaml file]' \
'--layout=[Path to a layout yaml file]' \
'-c+[Change where zellij looks for the configuration]' \
'--config=[Change where zellij looks for the configuration]' \
'--config-dir=[Change where zellij looks for the configuration]' \
'-d[]' \
'--debug[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_zellij_commands" \
"*::: :->zellij" \
&& ret=0
    case $state in
    (zellij)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:zellij-command-$line[1]:"
        case $line[1] in
            (option)
_arguments "${_arguments_options[@]}" \
'--clean[Disables loading of configuration file at default location]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(generate-completion)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':shell:_files' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" \
'--dump-config[Disables loading of configuration file at default location Dump the default configuration file to stdout]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_zellij_commands] )) ||
_zellij_commands() {
    local commands; commands=(
        "option:Change the behaviour of zellij" \
"generate-completion:" \
"setup:" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'zellij commands' commands "$@"
}
(( $+functions[_zellij__generate-completion_commands] )) ||
_zellij__generate-completion_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'zellij generate-completion commands' commands "$@"
}
(( $+functions[_zellij__help_commands] )) ||
_zellij__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'zellij help commands' commands "$@"
}
(( $+functions[_zellij__option_commands] )) ||
_zellij__option_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'zellij option commands' commands "$@"
}
(( $+functions[_zellij__setup_commands] )) ||
_zellij__setup_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'zellij setup commands' commands "$@"
}

_zellij "$@"