#compdef thqm

autoload -U is-at-least

_thqm() {
    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+[The port to listen on]:PORT: ' \
'--port=[The port to listen on]:PORT: ' \
'-U+[The username to authenticate with]:USERNAME: ' \
'--username=[The username to authenticate with]:USERNAME: ' \
'-P+[The password to authenticate with]:PASSWORD: ' \
'--password=[The password to authenticate with]:PASSWORD: ' \
'-S+[The entry separator]:SEPARATOR: ' \
'--separator=[The entry separator]:SEPARATOR: ' \
'-t+[The page title]:TITLE: ' \
'--title=[The page title]:TITLE: ' \
'-s+[The page style]:STYLE: ' \
'--style=[The page style]:STYLE: ' \
'--style-dir=[Specify style with its root directory]:PATH:_files -/' \
'--save-qrcode=[Save the qrcode image to file]:PATH:_files' \
'-Q[Show the qrcode in terminal]' \
'--qrcode[Show the qrcode in terminal]' \
'-u[Show the page url]' \
'--url[Show the page url]' \
'-o[Shutdown server after first selection]' \
'--oneshot[Shutdown server after first selection]' \
'-c[Show custom input field]' \
'--custom-input[Show custom input field]' \
'--list-styles[List available page styles]' \
'--no-shutdown[Don'\''t allow the server to be shutdown from the page]' \
'--no-qrcode[Don'\''t allow the qrcode to be shown in the page]' \
'--install-styles[Download and install styles to the user data directory]' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

(( $+functions[_thqm_commands] )) ||
_thqm_commands() {
    local commands; commands=()
    _describe -t commands 'thqm commands' commands "$@"
}

if [ "$funcstack[1]" = "_thqm" ]; then
    _thqm "$@"
else
    compdef _thqm thqm
fi
