#compdef eqr

autoload -U is-at-least

_eqr() {
    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[@]}" : \
'-o+[Output file (jpg/png/svg) \[default\: qr.png\]]:OUTPUT:_default' \
'--output=[Output file (jpg/png/svg) \[default\: qr.png\]]:OUTPUT:_default' \
'-l+[QR error correction level (L\: 7%, M\: 15%, Q\: 25%, H\: 30%)]:ERROR_CORRECTION_LEVEL:_default' \
'--level=[QR error correction level (L\: 7%, M\: 15%, Q\: 25%, H\: 30%)]:ERROR_CORRECTION_LEVEL:_default' \
'-e+[Edge size (in unit blocks)]:BORDER:_default' \
'--edge=[Edge size (in unit blocks)]:BORDER:_default' \
'(-t --terminal)-f+[Foreground RGB color (hex code)]:FG:_default' \
'(-t --terminal)--fg=[Foreground RGB color (hex code)]:FG:_default' \
'(-t --terminal)-b+[Background RGB color (hex code)]:BG:_default' \
'(-t --terminal)--bg=[Background RGB color (hex code)]:BG:_default' \
'(-t --terminal)-s+[Scale factor (1..255)]:SCALE:_default' \
'(-t --terminal)--scale=[Scale factor (1..255)]:SCALE:_default' \
'-t[Output to terminal]' \
'--terminal[Output to terminal]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::string -- String to encode (can also be piped in):_default' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_eqr" ]; then
    _eqr "$@"
else
    compdef _eqr eqr
fi
