#compdef eruption-macro

autoload -U is-at-least

_eruption-macro() {
    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[Verbose mode (-v, -vv, -vvv, etc.)]' \
'*--verbose[Verbose mode (-v, -vv, -vvv, etc.)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_eruption-macro_commands" \
"*::: :->eruption-macro" \
&& ret=0
    case $state in
    (eruption-macro)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:eruption-macro-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_PATH:_files' \
'--lua-path=[]:LUA_PATH:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(record)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_FILE:_files' \
'--lua-file=[]:LUA_FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
':macro_name:' \
'::description:' \
&& ret=0
;;
(create)
_arguments "${_arguments_options[@]}" \
'--description=[Specify a description for a macro]:DESCRIPTION: ' \
'-e[Specify the enabled status of the newly added macro]' \
'--enabled[Specify the enabled status of the newly added macro]' \
'-h[Print help]' \
'--help[Print help]' \
':macro_code:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':index:' \
&& ret=0
;;
(enable)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_FILE:_files' \
'--lua-file=[]:LUA_FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
':index:' \
&& ret=0
;;
(disable)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_FILE:_files' \
'--lua-file=[]:LUA_FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
':index:' \
&& ret=0
;;
(description)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_FILE:_files' \
'--lua-file=[]:LUA_FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
'::description:' \
&& ret=0
;;
(compile)
_arguments "${_arguments_options[@]}" \
'-l+[]:LUA_FILE:_files' \
'--lua-file=[]:LUA_FILE:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_eruption-macro__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:eruption-macro-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(record)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(create)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(enable)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(disable)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(description)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(compile)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_eruption-macro_commands] )) ||
_eruption-macro_commands() {
    local commands; commands=(
'list:Show a list of available macros in a Lua file' \
'record:Record a key sequence and save it as a macro' \
'create:Create a new macro from a description' \
'remove:Remove an existing macro' \
'enable:Enable an existing macro' \
'disable:Disable an existing macro' \
'description:Show or set the description of a specified macro' \
'compile:Compile macros to Lua code and make them available to Eruption' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'eruption-macro commands' commands "$@"
}
(( $+functions[_eruption-macro__compile_commands] )) ||
_eruption-macro__compile_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro compile commands' commands "$@"
}
(( $+functions[_eruption-macro__help__compile_commands] )) ||
_eruption-macro__help__compile_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help compile commands' commands "$@"
}
(( $+functions[_eruption-macro__completions_commands] )) ||
_eruption-macro__completions_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro completions commands' commands "$@"
}
(( $+functions[_eruption-macro__help__completions_commands] )) ||
_eruption-macro__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help completions commands' commands "$@"
}
(( $+functions[_eruption-macro__create_commands] )) ||
_eruption-macro__create_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro create commands' commands "$@"
}
(( $+functions[_eruption-macro__help__create_commands] )) ||
_eruption-macro__help__create_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help create commands' commands "$@"
}
(( $+functions[_eruption-macro__description_commands] )) ||
_eruption-macro__description_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro description commands' commands "$@"
}
(( $+functions[_eruption-macro__help__description_commands] )) ||
_eruption-macro__help__description_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help description commands' commands "$@"
}
(( $+functions[_eruption-macro__disable_commands] )) ||
_eruption-macro__disable_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro disable commands' commands "$@"
}
(( $+functions[_eruption-macro__help__disable_commands] )) ||
_eruption-macro__help__disable_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help disable commands' commands "$@"
}
(( $+functions[_eruption-macro__enable_commands] )) ||
_eruption-macro__enable_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro enable commands' commands "$@"
}
(( $+functions[_eruption-macro__help__enable_commands] )) ||
_eruption-macro__help__enable_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help enable commands' commands "$@"
}
(( $+functions[_eruption-macro__help_commands] )) ||
_eruption-macro__help_commands() {
    local commands; commands=(
'list:Show a list of available macros in a Lua file' \
'record:Record a key sequence and save it as a macro' \
'create:Create a new macro from a description' \
'remove:Remove an existing macro' \
'enable:Enable an existing macro' \
'disable:Disable an existing macro' \
'description:Show or set the description of a specified macro' \
'compile:Compile macros to Lua code and make them available to Eruption' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'eruption-macro help commands' commands "$@"
}
(( $+functions[_eruption-macro__help__help_commands] )) ||
_eruption-macro__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help help commands' commands "$@"
}
(( $+functions[_eruption-macro__help__list_commands] )) ||
_eruption-macro__help__list_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help list commands' commands "$@"
}
(( $+functions[_eruption-macro__list_commands] )) ||
_eruption-macro__list_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro list commands' commands "$@"
}
(( $+functions[_eruption-macro__help__record_commands] )) ||
_eruption-macro__help__record_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help record commands' commands "$@"
}
(( $+functions[_eruption-macro__record_commands] )) ||
_eruption-macro__record_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro record commands' commands "$@"
}
(( $+functions[_eruption-macro__help__remove_commands] )) ||
_eruption-macro__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro help remove commands' commands "$@"
}
(( $+functions[_eruption-macro__remove_commands] )) ||
_eruption-macro__remove_commands() {
    local commands; commands=()
    _describe -t commands 'eruption-macro remove commands' commands "$@"
}

if [ "$funcstack[1]" = "_eruption-macro" ]; then
    _eruption-macro "$@"
else
    compdef _eruption-macro eruption-macro
fi
