#compdef clipcatd

autoload -U is-at-least

_clipcatd() {
    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+[Specify a configuration file]:CONFIG_FILE:_files' \
'--config=[Specify a configuration file]:CONFIG_FILE:_files' \
'--history-file=[Specify a history file]:HISTORY_FILE_PATH:_files' \
'--grpc-host=[Specify gRPC host address]:GRPC_HOST: ' \
'--grpc-port=[Specify gRPC port number]:GRPC_PORT: ' \
'--grpc-socket-path=[Specify gRPC local socket path]:GRPC_SOCKET_PATH:_files' \
'--no-daemon[Do not run as daemon]' \
'-r[Try to replace existing daemon]' \
'--replace[Try to replace existing daemon]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_clipcatd_commands" \
"*::: :->clipcatd" \
&& ret=0
    case $state in
    (clipcatd)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:clipcatd-command-$line[1]:"
        case $line[1] in
            (version)
_arguments "${_arguments_options[@]}" \
'-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
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_clipcatd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:clipcatd-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
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_clipcatd_commands] )) ||
_clipcatd_commands() {
    local commands; commands=(
'version:Print version information' \
'completions:Output shell completion code for the specified shell (bash, zsh, fish)' \
'default-config:Output default configuration' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'clipcatd commands' commands "$@"
}
(( $+functions[_clipcatd__completions_commands] )) ||
_clipcatd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd completions commands' commands "$@"
}
(( $+functions[_clipcatd__help__completions_commands] )) ||
_clipcatd__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd help completions commands' commands "$@"
}
(( $+functions[_clipcatd__default-config_commands] )) ||
_clipcatd__default-config_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd default-config commands' commands "$@"
}
(( $+functions[_clipcatd__help__default-config_commands] )) ||
_clipcatd__help__default-config_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd help default-config commands' commands "$@"
}
(( $+functions[_clipcatd__help_commands] )) ||
_clipcatd__help_commands() {
    local commands; commands=(
'version:Print version information' \
'completions:Output shell completion code for the specified shell (bash, zsh, fish)' \
'default-config:Output default configuration' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'clipcatd help commands' commands "$@"
}
(( $+functions[_clipcatd__help__help_commands] )) ||
_clipcatd__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd help help commands' commands "$@"
}
(( $+functions[_clipcatd__help__version_commands] )) ||
_clipcatd__help__version_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd help version commands' commands "$@"
}
(( $+functions[_clipcatd__version_commands] )) ||
_clipcatd__version_commands() {
    local commands; commands=()
    _describe -t commands 'clipcatd version commands' commands "$@"
}

if [ "$funcstack[1]" = "_clipcatd" ]; then
    _clipcatd "$@"
else
    compdef _clipcatd clipcatd
fi
