#compdef dim

autoload -U is-at-least

_dim() {
    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[@]}" : \
'-d+[Duration in seconds, 0 is infinite, \[default\: 30\]]:DURATION:_default' \
'--duration=[Duration in seconds, 0 is infinite, \[default\: 30\]]:DURATION:_default' \
'-a+[0.0 is transparent, 1.0 is opaque. When opaque, cursor will be hidden. \[default\: 0.5\]]:ALPHA:_default' \
'--alpha=[0.0 is transparent, 1.0 is opaque. When opaque, cursor will be hidden. \[default\: 0.5\]]:ALPHA:_default' \
'--gen-completions=[Generate completions at given path]:PATH:_files' \
'-c+[Use config at path]:PATH:_files' \
'--config=[Use config at path]:PATH:_files' \
'-p[Make dim ignore input, passing it to lower surfaces. (You probably want to use \`-d 0\` with this)]' \
'--passthrough[Make dim ignore input, passing it to lower surfaces. (You probably want to use \`-d 0\` with this)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_dim" ]; then
    _dim "$@"
else
    compdef _dim dim
fi
