40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
#compdef mktemp
|
|
|
|
autoload -U is-at-least
|
|
|
|
_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[@]}" \
|
|
'-p+[specify the directory to create temporary files in]: :_files -/' \
|
|
'--tmpdir=[specify the directory to create temporary files in]: :_files -/' \
|
|
'-t+[specify a prefix to append to the created files]: : ' \
|
|
'--template=[specify a prefix to append to the created files]: : ' \
|
|
'-d[create a directory instead of a file]' \
|
|
'--directory[create a directory instead of a file]' \
|
|
'-u[immediately remove created files and directories]' \
|
|
'--dryrun[immediately remove created files and directories]' \
|
|
'-h[Print help]' \
|
|
'--help[Print help]' \
|
|
'-V[Print version]' \
|
|
'--version[Print version]' \
|
|
&& ret=0
|
|
}
|
|
|
|
(( $+functions[_mktemp_commands] )) ||
|
|
_mktemp_commands() {
|
|
local commands; commands=()
|
|
_describe -t commands 'mktemp commands' commands "$@"
|
|
}
|
|
|
|
_mktemp "$@"
|