mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-02-03 22:22:03 +00:00
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
#compdef trash
|
|
|
|
# AUTOMATICALLY GENERATED by `shtab`
|
|
|
|
|
|
_shtab_trash_commands() {
|
|
local _commands=(
|
|
|
|
)
|
|
_describe 'trash commands' _commands
|
|
}
|
|
|
|
_shtab_trash_options=(
|
|
"(- : *)"{-h,--help}"[show this help message and exit]"
|
|
"(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
|
|
{-d,--directory}"[ignored (for GNU rm compatibility)]"
|
|
{-f,--force}"[silently ignore nonexistent files]"
|
|
{-i,--interactive}"[prompt before every removal]"
|
|
{-r,-R,--recursive}"[ignored (for GNU rm compatibility)]"
|
|
"--trash-dir[use TRASHDIR as trash folder]:trashdir:(\${\$(trash-list --trash-dirs)#parent_*})"
|
|
"*"{-v,--verbose}"[explain what is being done]"
|
|
"(- : *)--version[show program\'s version number and exit]"
|
|
"(*)::files:_trash_files"
|
|
)
|
|
|
|
# guard to ensure default positional specs are added only once per session
|
|
_shtab_trash_defaults_added=0
|
|
|
|
|
|
_shtab_trash() {
|
|
local context state line curcontext="$curcontext" one_or_more='(*)' remainder='(-)*' default='*::: :->trash'
|
|
|
|
# Add default positional/remainder specs only if none exist, and only once per session
|
|
if (( ! _shtab_trash_defaults_added )); then
|
|
if (( ${_shtab_trash_options[(I)${(q)one_or_more}*]} + ${_shtab_trash_options[(I)${(q)remainder}*]} + ${_shtab_trash_options[(I)${(q)default}]} == 0 )); then
|
|
_shtab_trash_options+=(': :_shtab_trash_commands' '*::: :->trash')
|
|
fi
|
|
_shtab_trash_defaults_added=1
|
|
fi
|
|
_arguments -C -s $_shtab_trash_options
|
|
|
|
case $state in
|
|
trash)
|
|
words=($line[1] "${words[@]}")
|
|
(( CURRENT += 1 ))
|
|
curcontext="${curcontext%:*:*}:_shtab_trash-$line[1]:"
|
|
case $line[1] in
|
|
|
|
esac
|
|
esac
|
|
}
|
|
|
|
# Custom Preamble
|
|
|
|
# https://github.com/zsh-users/zsh/blob/19390a1ba8dc983b0a1379058e90cd51ce156815/Completion/Unix/Command/_rm#L72-L74
|
|
_trash_files() {
|
|
(( CURRENT > 0 )) && line[CURRENT]=()
|
|
line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} )
|
|
_files -F line
|
|
}
|
|
|
|
# End Custom Preamble
|
|
|
|
|
|
typeset -A opt_args
|
|
|
|
if [[ $zsh_eval_context[-1] == eval ]]; then
|
|
# eval/source/. command, register function for later
|
|
compdef _shtab_trash -N trash
|
|
else
|
|
# autoload from fpath, call function directly
|
|
_shtab_trash "$@"
|
|
fi
|
|
|