#compdef base32

autoload -U is-at-least

_base32() {
    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[@]}" : \
'-w+[wrap encoded lines after COLS character (default 76, 0 to disable wrapping)]:COLS:_default' \
'--wrap=[wrap encoded lines after COLS character (default 76, 0 to disable wrapping)]:COLS:_default' \
'-d[decode data]' \
'-D[decode data]' \
'--decode[decode data]' \
'-i[when decoding, ignore non-alphabetic characters]' \
'--ignore-garbage[when decoding, ignore non-alphabetic characters]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::file:_files' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_base32" ]; then
    _base32 "$@"
else
    compdef _base32 base32
fi
