#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+[base-common-help-wrap]:COLS:_default' \
'--wrap=[base-common-help-wrap]:COLS:_default' \
'-d[base-common-help-decode]' \
'-D[base-common-help-decode]' \
'--decode[base-common-help-decode]' \
'-i[base-common-help-ignore-garbage]' \
'--ignore-garbage[base-common-help-ignore-garbage]' \
'-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
