#compdef basenc

autoload -U is-at-least

_basenc() {
    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]' \
'--base64[basenc-help-base64]' \
'--base64url[basenc-help-base64url]' \
'--base32[basenc-help-base32]' \
'--base32hex[basenc-help-base32hex]' \
'--base16[basenc-help-base16]' \
'--base2lsbf[basenc-help-base2lsbf]' \
'--base2msbf[basenc-help-base2msbf]' \
'--z85[basenc-help-z85]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::file:_files' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_basenc" ]; then
    _basenc "$@"
else
    compdef _basenc basenc
fi
