#compdef qrtool

autoload -U is-at-least

_qrtool() {
    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[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_qrtool_commands" \
"*::: :->qrtool" \
&& ret=0
    case $state in
    (qrtool)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:qrtool-command-$line[1]:"
        case $line[1] in
            (encode)
_arguments "${_arguments_options[@]}" : \
'-o+[Output the result to a file]:FILE:_files' \
'--output=[Output the result to a file]:FILE:_files' \
'()-r+[Read input data from a file]:FILE:_files' \
'()--read-from=[Read input data from a file]:FILE:_files' \
'-s+[The module size in pixels]:NUMBER:_default' \
'--size=[The module size in pixels]:NUMBER:_default' \
'-l+[Error correction level]:LEVEL:((l\:"Level L"
m\:"Level M"
q\:"Level Q"
h\:"Level H"))' \
'--error-correction-level=[Error correction level]:LEVEL:((l\:"Level L"
m\:"Level M"
q\:"Level Q"
h\:"Level H"))' \
'--level=[Error correction level]:LEVEL:((l\:"Level L"
m\:"Level M"
q\:"Level Q"
h\:"Level H"))' \
'-v+[The version of the symbol]:NUMBER:_default' \
'--symbol-version=[The version of the symbol]:NUMBER:_default' \
'--symversion=[The version of the symbol]:NUMBER:_default' \
'-m+[The width of margin]:NUMBER:_default' \
'--margin=[The width of margin]:NUMBER:_default' \
'-t+[The format of the output]:FORMAT:((png\:"Portable Network Graphics"
svg\:"Scalable Vector Graphics"
pic\:"PIC markup language"
ansi\:"To the terminal using 4-bit ANSI escape sequences"
ansi256\:"To the terminal using 8-bit ANSI escape sequences"
ansi-true-color\:"To the terminal using 24-bit ANSI escape sequences"
ascii\:"To the terminal as ASCII string"
ascii-invert\:"To the terminal as ASCII string"
unicode\:"To the terminal as UTF-8 string"
unicode-invert\:"To the terminal as UTF-8 string"))' \
'--type=[The format of the output]:FORMAT:((png\:"Portable Network Graphics"
svg\:"Scalable Vector Graphics"
pic\:"PIC markup language"
ansi\:"To the terminal using 4-bit ANSI escape sequences"
ansi256\:"To the terminal using 8-bit ANSI escape sequences"
ansi-true-color\:"To the terminal using 24-bit ANSI escape sequences"
ascii\:"To the terminal as ASCII string"
ascii-invert\:"To the terminal as ASCII string"
unicode\:"To the terminal as UTF-8 string"
unicode-invert\:"To the terminal as UTF-8 string"))' \
'--optimize-png=[Set the optimization level for a PNG image]' \
'--zopfli=[Use Zopfli to compress PNG image]' \
'--mode=[The mode of the output]:MODE:((numeric\:"All digits"
alphanumeric\:"Alphanumerics and few symbols"
byte\:"Arbitrary binary data"
kanji\:"Shift JIS text"))' \
'--variant=[The type of QR code]:TYPE:((normal\:"Normal QR code"
micro\:"Micro QR code"))' \
'--foreground=[Foreground color]:COLOR:_default' \
'--background=[Background color]:COLOR:_default' \
'--verbose[Also print the metadata]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::input -- Input data:_default' \
&& ret=0
;;
(decode)
_arguments "${_arguments_options[@]}" : \
'-t+[The format of the input]:FORMAT:((bmp\:"Windows Bitmap"
dds\:"DirectDraw Surface"
farbfeld\:"Farbfeld"
gif\:"Graphics Interchange Format"
hdr\:"Radiance RGBE"
ico\:"ICO file format"
jpeg\:"JPEG"
openexr\:"OpenEXR"
png\:"Portable Network Graphics"
pnm\:"Portable Anymap Format"
qoi\:"Quite OK Image Format"
svg\:"Scalable Vector Graphics"
tga\:"Truevision TGA"
tiff\:"Tag Image File Format"
webp\:"WebP"
xbm\:"X BitMap"))' \
'--type=[The format of the input]:FORMAT:((bmp\:"Windows Bitmap"
dds\:"DirectDraw Surface"
farbfeld\:"Farbfeld"
gif\:"Graphics Interchange Format"
hdr\:"Radiance RGBE"
ico\:"ICO file format"
jpeg\:"JPEG"
openexr\:"OpenEXR"
png\:"Portable Network Graphics"
pnm\:"Portable Anymap Format"
qoi\:"Quite OK Image Format"
svg\:"Scalable Vector Graphics"
tga\:"Truevision TGA"
tiff\:"Tag Image File Format"
webp\:"WebP"
xbm\:"X BitMap"))' \
'(--metadata)--verbose[Also print the metadata]' \
'--metadata[Print only the metadata]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::input -- Input image file:_files' \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
':shell -- Shell to generate completion for:((bash\:"Bash"
elvish\:"Elvish"
fish\:"fish"
nushell\:"Nushell"
powershell\:"PowerShell"
zsh\:"Zsh"))' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_qrtool__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:qrtool-help-command-$line[1]:"
        case $line[1] in
            (encode)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(decode)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_qrtool_commands] )) ||
_qrtool_commands() {
    local commands; commands=(
'encode:Encode input data in a QR code' \
'decode:Detect and decode a QR code' \
'completion:Generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'qrtool commands' commands "$@"
}
(( $+functions[_qrtool__completion_commands] )) ||
_qrtool__completion_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool completion commands' commands "$@"
}
(( $+functions[_qrtool__decode_commands] )) ||
_qrtool__decode_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool decode commands' commands "$@"
}
(( $+functions[_qrtool__encode_commands] )) ||
_qrtool__encode_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool encode commands' commands "$@"
}
(( $+functions[_qrtool__help_commands] )) ||
_qrtool__help_commands() {
    local commands; commands=(
'encode:Encode input data in a QR code' \
'decode:Detect and decode a QR code' \
'completion:Generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'qrtool help commands' commands "$@"
}
(( $+functions[_qrtool__help__completion_commands] )) ||
_qrtool__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool help completion commands' commands "$@"
}
(( $+functions[_qrtool__help__decode_commands] )) ||
_qrtool__help__decode_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool help decode commands' commands "$@"
}
(( $+functions[_qrtool__help__encode_commands] )) ||
_qrtool__help__encode_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool help encode commands' commands "$@"
}
(( $+functions[_qrtool__help__help_commands] )) ||
_qrtool__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'qrtool help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_qrtool" ]; then
    _qrtool "$@"
else
    compdef _qrtool qrtool
fi
