#compdef qrrs

autoload -U is-at-least

_qrrs() {
    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+[Format in which the qrcode will be saved]:FORMAT:(image svg unicode)' \
'--output-format=[Format in which the qrcode will be saved]:FORMAT:(image svg unicode)' \
'-m+[Margin applied to qrcode]:margin: ' \
'--margin=[Margin applied to qrcode]:margin: ' \
'-r[Read the qrcode instead of generating it]' \
'--read[Read the qrcode instead of generating it]' \
'-t[Display code in terminal]' \
'--terminal[Display code in terminal]' \
'-i[Invert qrcode colors]' \
'--invert_colors[Invert qrcode colors]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
':INPUT -- Input data:_files' \
'::OUTPUT -- Output file:_files' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_qrrs" ]; then
    _qrrs "$@"
else
    compdef _qrrs qrrs
fi
