#compdef uu-cksum

autoload -U is-at-least

_uu-cksum() {
    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[@]}" : \
'-a+[select the digest type to use. See DIGEST below]:ALGORITHM:(sysv bsd crc crc32b md5 sha1 sha2 sha3 blake2b sm3 sha224 sha256 sha384 sha512 blake3 shake128 shake256)' \
'--algorithm=[select the digest type to use. See DIGEST below]:ALGORITHM:(sysv bsd crc crc32b md5 sha1 sha2 sha3 blake2b sm3 sha224 sha256 sha384 sha512 blake3 shake128 shake256)' \
'-l+[digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8]: :_default' \
'--length=[digest length in bits; must not exceed the max for the blake2 algorithm and must be a multiple of 8]: :_default' \
'--untagged[create a reversed style checksum, without digest type]' \
'--tag[create a BSD style checksum, undo --untagged (default)]' \
'--raw[emit a raw binary digest, not hexadecimal]' \
'--strict[exit non-zero for improperly formatted checksum lines]' \
'-c[read hashsums from the FILEs and check them]' \
'--check[read hashsums from the FILEs and check them]' \
'(--raw)--base64[emit a base64 digest, not hexadecimal]' \
'-t[]' \
'--text[]' \
'-b[]' \
'--binary[]' \
'-w[warn about improperly formatted checksum lines]' \
'--warn[warn about improperly formatted checksum lines]' \
'--status[don'\''t output anything, status code shows success]' \
'--quiet[don'\''t print OK for each successfully verified file]' \
'--ignore-missing[don'\''t fail or report status for missing files]' \
'-z[end each output line with NUL, not newline, and disable file name escaping]' \
'--zero[end each output line with NUL, not newline, and disable file name escaping]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::file:_files' \
&& ret=0
}

(( $+functions[_uu-cksum_commands] )) ||
_uu-cksum_commands() {
    local commands; commands=()
    _describe -t commands 'uu-cksum commands' commands "$@"
}

if [ "$funcstack[1]" = "_uu-cksum" ]; then
    _uu-cksum "$@"
else
    compdef _uu-cksum uu-cksum
fi
