#compdef mqttui

autoload -U is-at-least

_mqttui() {
    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[@]}" : \
'--payload-size-limit=[Truncate the payloads stored to the given size]:PAYLOAD_SIZE_LIMIT:' \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::topic -- Topic to watch:' \
":: :_mqttui_commands" \
"*::: :->mqttui" \
&& ret=0
    case $state in
    (mqttui)
        words=($line[2] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:mqttui-command-$line[2]:"
        case $line[2] in
            (clean-retained)
_arguments "${_arguments_options[@]}" : \
'--timeout=[When there is no message received for the given time the operation is considered done]:SECONDS:' \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'--dry-run[Dont clean topics, only log them]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic which gets cleaned:' \
&& ret=0
;;
(c)
_arguments "${_arguments_options[@]}" : \
'--timeout=[When there is no message received for the given time the operation is considered done]:SECONDS:' \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'--dry-run[Dont clean topics, only log them]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic which gets cleaned:' \
&& ret=0
;;
(clean)
_arguments "${_arguments_options[@]}" : \
'--timeout=[When there is no message received for the given time the operation is considered done]:SECONDS:' \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'--dry-run[Dont clean topics, only log them]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic which gets cleaned:' \
&& ret=0
;;
(log)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-j[Output incoming packages as newline-delimited JSON]' \
'--json[Output incoming packages as newline-delimited JSON]' \
'-v[Show full MQTT communication]' \
'--verbose[Show full MQTT communication]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::topic -- Topics to watch:' \
&& ret=0
;;
(l)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-j[Output incoming packages as newline-delimited JSON]' \
'--json[Output incoming packages as newline-delimited JSON]' \
'-v[Show full MQTT communication]' \
'--verbose[Show full MQTT communication]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::topic -- Topics to watch:' \
&& ret=0
;;
(read-one)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Do not return on a retained message on connection, wait for another message to arrive]' \
'--ignore-retained[Do not return on a retained message on connection, wait for another message to arrive]' \
'-p[Parse the payload and print it in a human readable pretty form]' \
'--pretty[Parse the payload and print it in a human readable pretty form]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::topic -- Topics to watch:' \
&& ret=0
;;
(r)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Do not return on a retained message on connection, wait for another message to arrive]' \
'--ignore-retained[Do not return on a retained message on connection, wait for another message to arrive]' \
'-p[Parse the payload and print it in a human readable pretty form]' \
'--pretty[Parse the payload and print it in a human readable pretty form]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::topic -- Topics to watch:' \
&& ret=0
;;
(read)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Do not return on a retained message on connection, wait for another message to arrive]' \
'--ignore-retained[Do not return on a retained message on connection, wait for another message to arrive]' \
'-p[Parse the payload and print it in a human readable pretty form]' \
'--pretty[Parse the payload and print it in a human readable pretty form]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'*::topic -- Topics to watch:' \
&& ret=0
;;
(publish)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Publish the MQTT message retained]' \
'--retain[Publish the MQTT message retained]' \
'-v[Show full MQTT communication]' \
'--verbose[Show full MQTT communication]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic to publish to:' \
'::payload -- Payload to be published:_default' \
&& ret=0
;;
(p)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Publish the MQTT message retained]' \
'--retain[Publish the MQTT message retained]' \
'-v[Show full MQTT communication]' \
'--verbose[Show full MQTT communication]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic to publish to:' \
'::payload -- Payload to be published:_default' \
&& ret=0
;;
(pub)
_arguments "${_arguments_options[@]}" : \
'-b+[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'--broker=[URL which represents how to connect to the MQTT broker]:URL:_urls' \
'-u+[Username to access the mqtt broker]:STRING:_users' \
'--username=[Username to access the mqtt broker]:STRING:_users' \
'--password=[Password to access the mqtt broker]:STRING:' \
'-i+[Specify the client id to connect with]:STRING:' \
'--client-id=[Specify the client id to connect with]:STRING:' \
'--client-cert=[Path to the TLS client certificate file]:FILEPATH:_files' \
'--client-key=[Path to the TLS client private key]:FILEPATH:_files' \
'-r[Publish the MQTT message retained]' \
'--retain[Publish the MQTT message retained]' \
'-v[Show full MQTT communication]' \
'--verbose[Show full MQTT communication]' \
'--insecure[Allow insecure TLS connections]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':topic -- Topic to publish to:' \
'::payload -- Payload to be published:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_mqttui__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:mqttui-help-command-$line[1]:"
        case $line[1] in
            (clean-retained)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(log)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(read-one)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(publish)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_mqttui_commands] )) ||
_mqttui_commands() {
    local commands; commands=(
'clean-retained:Clean retained messages from the broker' \
'c:Clean retained messages from the broker' \
'clean:Clean retained messages from the broker' \
'log:Log values from subscribed topics to stdout' \
'l:Log values from subscribed topics to stdout' \
'read-one:Wait for the first message on the given topic(s) and return its payload to stdout' \
'r:Wait for the first message on the given topic(s) and return its payload to stdout' \
'read:Wait for the first message on the given topic(s) and return its payload to stdout' \
'publish:Publish a value quickly' \
'p:Publish a value quickly' \
'pub:Publish a value quickly' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'mqttui commands' commands "$@"
}
(( $+functions[_mqttui__clean-retained_commands] )) ||
_mqttui__clean-retained_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui clean-retained commands' commands "$@"
}
(( $+functions[_mqttui__help_commands] )) ||
_mqttui__help_commands() {
    local commands; commands=(
'clean-retained:Clean retained messages from the broker' \
'log:Log values from subscribed topics to stdout' \
'read-one:Wait for the first message on the given topic(s) and return its payload to stdout' \
'publish:Publish a value quickly' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'mqttui help commands' commands "$@"
}
(( $+functions[_mqttui__help__clean-retained_commands] )) ||
_mqttui__help__clean-retained_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui help clean-retained commands' commands "$@"
}
(( $+functions[_mqttui__help__help_commands] )) ||
_mqttui__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui help help commands' commands "$@"
}
(( $+functions[_mqttui__help__log_commands] )) ||
_mqttui__help__log_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui help log commands' commands "$@"
}
(( $+functions[_mqttui__help__publish_commands] )) ||
_mqttui__help__publish_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui help publish commands' commands "$@"
}
(( $+functions[_mqttui__help__read-one_commands] )) ||
_mqttui__help__read-one_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui help read-one commands' commands "$@"
}
(( $+functions[_mqttui__log_commands] )) ||
_mqttui__log_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui log commands' commands "$@"
}
(( $+functions[_mqttui__publish_commands] )) ||
_mqttui__publish_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui publish commands' commands "$@"
}
(( $+functions[_mqttui__read-one_commands] )) ||
_mqttui__read-one_commands() {
    local commands; commands=()
    _describe -t commands 'mqttui read-one commands' commands "$@"
}

if [ "$funcstack[1]" = "_mqttui" ]; then
    _mqttui "$@"
else
    compdef _mqttui mqttui
fi
