#compdef clipcat-menu

autoload -U is-at-least

_clipcat-menu() {
    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[@]}" : \
'--log-level=[Specify a log level]:LOG_LEVEL:_default' \
'-c+[Specify a configuration file]:CONFIG_FILE:_files' \
'--config=[Specify a configuration file]:CONFIG_FILE:_files' \
'-f+[Specify a finder]:FINDER:_default' \
'--finder=[Specify a finder]:FINDER:_default' \
'--rofi-menu-length=[Specify the menu length for Rofi]:rofi-menu-length:_default' \
'--rofi-line-length=[Specify the length of a line showing on Rofi]:rofi-line-length:_default' \
'--rofi-extra-arguments=[Extra arguments pass to Rofi, use '\'','\'' to separate arguments]:rofi-extra-arguments:_default' \
'--dmenu-menu-length=[Specify the menu length of dmenu]:dmenu-menu-length:_default' \
'--dmenu-line-length=[Specify the length of a line showing on dmenu]:dmenu-line-length:_default' \
'--dmenu-extra-arguments=[Extra arguments pass to dmenu, use '\'','\'' to separate arguments]:dmenu-extra-arguments:_default' \
'--custom-finder-program-path=[The program path of custom finder]:custom-finder-program-path:_files' \
'--custom-finder-arguments=[Arguments pass to custom finder, use '\'','\'' to separate arguments]:custom-finder-arguments:_default' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_clipcat-menu_commands" \
"*::: :->clipcat-menu" \
&& ret=0
    case $state in
    (clipcat-menu)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:clipcat-menu-command-$line[1]:"
        case $line[1] in
            (version)
_arguments "${_arguments_options[@]}" : \
'--client[If true, shows client version only (no server required).]' \
'-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
;;
(default-config)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(list-finder)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(insert)
_arguments "${_arguments_options[@]}" : \
'*-k+[Specify which clipboard to insert ("clipboard", "primary", "secondary")]:KINDS:_default' \
'*--kinds=[Specify which clipboard to insert ("clipboard", "primary", "secondary")]:KINDS:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" : \
'-e+[Specify a external editor]:EDITOR:_default' \
'--editor=[Specify a external editor]:EDITOR:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_clipcat-menu__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:clipcat-menu-help-command-$line[1]:"
        case $line[1] in
            (version)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(default-config)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list-finder)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(insert)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(edit)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_clipcat-menu_commands] )) ||
_clipcat-menu_commands() {
    local commands; commands=(
'version:Print the client and server version information' \
'completions:Output shell completion code for the specified shell (bash, zsh, fish)' \
'default-config:Output default configuration' \
'list-finder:Print available text finders' \
'insert:Insert selected clip into clipboard' \
'remove:Remove selected clip' \
'edit:Edit selected clip' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'clipcat-menu commands' commands "$@"
}
(( $+functions[_clipcat-menu__completions_commands] )) ||
_clipcat-menu__completions_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu completions commands' commands "$@"
}
(( $+functions[_clipcat-menu__default-config_commands] )) ||
_clipcat-menu__default-config_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu default-config commands' commands "$@"
}
(( $+functions[_clipcat-menu__edit_commands] )) ||
_clipcat-menu__edit_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu edit commands' commands "$@"
}
(( $+functions[_clipcat-menu__help_commands] )) ||
_clipcat-menu__help_commands() {
    local commands; commands=(
'version:Print the client and server version information' \
'completions:Output shell completion code for the specified shell (bash, zsh, fish)' \
'default-config:Output default configuration' \
'list-finder:Print available text finders' \
'insert:Insert selected clip into clipboard' \
'remove:Remove selected clip' \
'edit:Edit selected clip' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'clipcat-menu help commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__completions_commands] )) ||
_clipcat-menu__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help completions commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__default-config_commands] )) ||
_clipcat-menu__help__default-config_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help default-config commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__edit_commands] )) ||
_clipcat-menu__help__edit_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help edit commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__help_commands] )) ||
_clipcat-menu__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help help commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__insert_commands] )) ||
_clipcat-menu__help__insert_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help insert commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__list-finder_commands] )) ||
_clipcat-menu__help__list-finder_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help list-finder commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__remove_commands] )) ||
_clipcat-menu__help__remove_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help remove commands' commands "$@"
}
(( $+functions[_clipcat-menu__help__version_commands] )) ||
_clipcat-menu__help__version_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu help version commands' commands "$@"
}
(( $+functions[_clipcat-menu__insert_commands] )) ||
_clipcat-menu__insert_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu insert commands' commands "$@"
}
(( $+functions[_clipcat-menu__list-finder_commands] )) ||
_clipcat-menu__list-finder_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu list-finder commands' commands "$@"
}
(( $+functions[_clipcat-menu__remove_commands] )) ||
_clipcat-menu__remove_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu remove commands' commands "$@"
}
(( $+functions[_clipcat-menu__version_commands] )) ||
_clipcat-menu__version_commands() {
    local commands; commands=()
    _describe -t commands 'clipcat-menu version commands' commands "$@"
}

if [ "$funcstack[1]" = "_clipcat-menu" ]; then
    _clipcat-menu "$@"
else
    compdef _clipcat-menu clipcat-menu
fi
