#compdef uu-mktemp

autoload -U is-at-least

_uu-mktemp() {
    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[@]}" : \
'--suffix=[append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. This option is implied if TEMPLATE does not end with X.]:SUFFIX:_default' \
'-p+[short form of --tmpdir]:DIR:_files -/' \
'--tmpdir=[interpret TEMPLATE relative to DIR; if DIR is not specified, use \$TMPDIR (\$TMP on windows) if set, else /tmp. With this option, TEMPLATE must not be an absolute name; unlike with -t, TEMPLATE may contain slashes, but mktemp creates only the final component]' \
'-d[Make a directory instead of a file]' \
'--directory[Make a directory instead of a file]' \
'-u[do not create anything; merely print a name (unsafe)]' \
'--dry-run[do not create anything; merely print a name (unsafe)]' \
'-q[Fail silently if an error occurs.]' \
'--quiet[Fail silently if an error occurs.]' \
'-t[Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) to create a filename template \[deprecated\]]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::template:_default' \
&& ret=0
}

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

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