mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-18 09:28:02 +02:00
github #99: _trash: add completion for trash-d
https://github.com/rushsteve1/trash-d
This commit is contained in:
parent
c4ec7442f1
commit
5ec4695033
3 changed files with 62 additions and 22 deletions
|
@ -1,3 +1,8 @@
|
|||
2023-07-19 dana <dana@dana.is>
|
||||
|
||||
* github #99: mirsella: Completion/Darwin/Command/_trash,
|
||||
Completion/Unix/Command/_trash: add completion for trash-d
|
||||
|
||||
2023-07-10 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 51897 (+ minor tweaks): Completion/Darwin/Command/_softwareupdate:
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#compdef trash
|
||||
|
||||
# We only provide completion for Ali Rantakari's trash utility. There are/were a
|
||||
# few others floating around with that name, but this is the one available as
|
||||
# `trash` in Homebrew and MacPorts
|
||||
_pick_variant ali='(Rantakari|hasseg)' other --version && {
|
||||
# The hidden options here are options to rm that trash silently (and
|
||||
# undocumentedly) ignores. Some options are not made mutually exclusive where
|
||||
# they technically could be, for compatibility with aliases, etc.
|
||||
_arguments -s -S -A '-*' : \
|
||||
'!-'{d,f,i,r,P,R,W} \
|
||||
'(: * -F -l -v)-e[empty trash]' \
|
||||
'-F[use Finder instead of system API]' \
|
||||
'(: * -e -F -s -y)-l[list items in trash]' \
|
||||
'(: * -F -l -v)-s[securely empty trash]' \
|
||||
'-v[increase output verbosity]' \
|
||||
'-y[skip confirmation prompts (with -e or -s)]' \
|
||||
'*: :_files'
|
||||
return
|
||||
}
|
||||
|
||||
_default
|
57
Completion/Unix/Command/_trash
Normal file
57
Completion/Unix/Command/_trash
Normal file
|
@ -0,0 +1,57 @@
|
|||
#compdef trash
|
||||
|
||||
local variant
|
||||
|
||||
_pick_variant -r variant ali='(Rantakari|hasseg)' steven='(Steven|vanZyl)' other --version
|
||||
|
||||
case $variant in
|
||||
ali)
|
||||
# The hidden options here are options to rm that trash silently (and
|
||||
# undocumentedly) ignores. Some options are not made mutually exclusive where
|
||||
# they technically could be, for compatibility with aliases, etc.
|
||||
_arguments -s -S -A '-*' : \
|
||||
'!-'{d,f,i,r,P,R,W} \
|
||||
'(: * -F -l -v)-e[empty trash]' \
|
||||
'-F[use Finder instead of system API]' \
|
||||
'(: * -e -F -s -y)-l[list items in trash]' \
|
||||
'(: * -F -l -v)-s[securely empty trash]' \
|
||||
'-v[increase output verbosity]' \
|
||||
'-y[skip confirmation prompts (with -e or -s)]' \
|
||||
'*: :_files'
|
||||
return
|
||||
;;
|
||||
steven)
|
||||
local trash_dir="${TRASH_D_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/Trash}/files"
|
||||
|
||||
local -a args=(
|
||||
'(-v --verbose)'{-v,--verbose}'[print more information]'
|
||||
|
||||
+ options
|
||||
'(-d --dir)'{-d,--dir}'[remove empty directories]'
|
||||
'(-r -R --recursive)'{-r,-R,--recursive}'[delete directories and their contents]'
|
||||
'--rm[permanently delete files]'
|
||||
|
||||
+ '(interactive)'
|
||||
{-i,--interactive}'[ask before each deletion]'
|
||||
{-I,--interactive-once}'[ask before deleting 3 or more files, or deleting recursively]'
|
||||
{-f,--force}'[don'\''t prompt and ignore errors]'
|
||||
|
||||
+ '(actions)'
|
||||
'(options input info interactive)--list[list out the files in the trash]'
|
||||
'(options input info interactive)--orphans[list orphaned files in the trash]'
|
||||
'(options input info)--restore[restore specified file from the trash]:trashed file:_files -W "$trash_dir"'
|
||||
'(options input info)--delete[delete specified file from the trash]:trashed file:_files -W "$trash_dir"'
|
||||
'(options input info)--empty[empty the trash bin]'
|
||||
|
||||
+ info
|
||||
'(- *)'{-h,--help}'[display help information]'
|
||||
'(- *)--version[output the version and exit]'
|
||||
|
||||
+ input
|
||||
'(actions)*: :_files'
|
||||
)
|
||||
_arguments -s -S : $args
|
||||
return
|
||||
;;
|
||||
*) _default ;;
|
||||
esac
|
Loading…
Reference in a new issue