#compdef cherryrgb_cli

autoload -U is-at-least

_cherryrgb_cli() {
    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[@]}" : \
'-p+[Must be specified if multiple cherry products are detected. Interpreted as hex, if prefixed with '\''0x'\'', as dec otherwise]:PRODUCT_ID:_default' \
'--product-id=[Must be specified if multiple cherry products are detected. Interpreted as hex, if prefixed with '\''0x'\'', as dec otherwise]:PRODUCT_ID:_default' \
'-b+[Set brightness]:BRIGHTNESS:(off low medium high full)' \
'--brightness=[Set brightness]:BRIGHTNESS:(off low medium high full)' \
'-d[Enable debug output]' \
'--debug[Enable debug output]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_cherryrgb_cli_commands" \
"*::: :->cherryrgb_cli" \
&& ret=0
    case $state in
    (cherryrgb_cli)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:cherryrgb_cli-command-$line[1]:"
        case $line[1] in
            (animation)
_arguments "${_arguments_options[@]}" : \
'-r[Enable rainbow colors]' \
'--rainbow[Enable rainbow colors]' \
'-h[Print help]' \
'--help[Print help]' \
':mode -- Set LED mode:(wave spectrum breathing static radar vortex fire stars rain rolling curve wave_mid scan radiation ripples single_key)' \
':speed -- Set speed:(very_fast fast medium slow very_slow)' \
'::color -- Color (e.g ff00ff):_default' \
&& ret=0
;;
(custom-colors)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::colors -- One or more RGB color specs (6-digit hex numbers):_default' \
&& ret=0
;;
(color-profile-file)
_arguments "${_arguments_options[@]}" : \
'-k[If enabled, modifies existing color profile]' \
'--keep-existing-colors[If enabled, modifies existing color profile]' \
'-h[Print help]' \
'--help[Print help]' \
':file_path -- A json encoded file, specifying key colors:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_cherryrgb_cli__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:cherryrgb_cli-help-command-$line[1]:"
        case $line[1] in
            (animation)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(custom-colors)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(color-profile-file)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_cherryrgb_cli_commands] )) ||
_cherryrgb_cli_commands() {
    local commands; commands=(
'animation:Configure RGB keyboard illumination' \
'custom-colors:Configure custom RGB colors' \
'color-profile-file:Configure custom RGB colors from file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'cherryrgb_cli commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__animation_commands] )) ||
_cherryrgb_cli__subcmd__animation_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli animation commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__color-profile-file_commands] )) ||
_cherryrgb_cli__subcmd__color-profile-file_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli color-profile-file commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__custom-colors_commands] )) ||
_cherryrgb_cli__subcmd__custom-colors_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli custom-colors commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__help_commands] )) ||
_cherryrgb_cli__subcmd__help_commands() {
    local commands; commands=(
'animation:Configure RGB keyboard illumination' \
'custom-colors:Configure custom RGB colors' \
'color-profile-file:Configure custom RGB colors from file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'cherryrgb_cli help commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__help__subcmd__animation_commands] )) ||
_cherryrgb_cli__subcmd__help__subcmd__animation_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli help animation commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__help__subcmd__color-profile-file_commands] )) ||
_cherryrgb_cli__subcmd__help__subcmd__color-profile-file_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli help color-profile-file commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__help__subcmd__custom-colors_commands] )) ||
_cherryrgb_cli__subcmd__help__subcmd__custom-colors_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli help custom-colors commands' commands "$@"
}
(( $+functions[_cherryrgb_cli__subcmd__help__subcmd__help_commands] )) ||
_cherryrgb_cli__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'cherryrgb_cli help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_cherryrgb_cli" ]; then
    _cherryrgb_cli "$@"
else
    compdef _cherryrgb_cli cherryrgb_cli
fi
