#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\]]:QR_PATH:_default' \
'--output=[Output file (jpg/png/svg) \[default\: qr.png\]]:QR_PATH:_default' \
'-l+[QR error correction level (L\: 7%, M\: 15%, Q\: 25%, H\: 30%)]:LEVEL:_default' \
'--level=[QR error correction level (L\: 7%, M\: 15%, Q\: 25%, H\: 30%)]:LEVEL:_default' \
'-p+[Path to logo (png/jpg)]:LOGO_PATH:_files' \
'--path=[Path to logo (png/jpg)]:LOGO_PATH:_files' \
'-P+[Logo proportion to the whole image (0..1)]:PROPORTION:_default' \
'--proportion=[Logo proportion to the whole image (0..1)]:PROPORTION:_default' \
'-e+[Edge size (in unit blocks)]:EDGE:_default' \
'--edge=[Edge size (in unit blocks)]:EDGE:_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+[Size of unit block in pixels (1..255)]:SCALE:_default' \
'(-t --terminal)--scale=[Size of unit block in pixels (1..255)]:SCALE:_default' \
'-t[Output to terminal (never the logo)]' \
'--terminal[Output to terminal (never the logo)]' \
'-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
