shitbox/pkg/usr/share/zsh/site-functions/_rm

43 lines
1.2 KiB
Plaintext

#compdef rm
autoload -U is-at-least
_rm() {
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[@]}" \
'--interactive=[when to prompt]' \
'-i[prompt before every removal]' \
'-I[prompt once before removing more than three files, or when removing recursively;
less intrusive than -i, while still giving protection against most mistakes]' \
'-f[ignore nonexistent files and arguments, never prompt]' \
'--force[ignore nonexistent files and arguments, never prompt]' \
'-R[operate on files and directories recursively]' \
'--recursive[operate on files and directories recursively]' \
'-v[output a diagnostic for every file processed]' \
'--verbose[output a diagnostic for every file processed]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'*::file:_files' \
&& ret=0
}
(( $+functions[_rm_commands] )) ||
_rm_commands() {
local commands; commands=()
_describe -t commands 'rm commands' commands "$@"
}
_rm "$@"