summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_trash
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2025-04-30 02:07:56 -0700
commit26e09889646be3ea65b4a3dfeda26213e4bb6a27 (patch)
tree4f3c73a9416bf47ad7e125383d23cf42879e38d7 /Completion/Unix/Command/_trash
parent841bce705a58b04220b1f257abcc00ae71cbdbdc (diff)
parent001cba48ce3b964cf01fb3e2af54b20eacbc9bf5 (diff)
downloadzsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.tar.gz
zsh-26e09889646be3ea65b4a3dfeda26213e4bb6a27.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Completion/Unix/Command/_trash')
-rw-r--r--Completion/Unix/Command/_trash57
1 files changed, 57 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_trash b/Completion/Unix/Command/_trash
new file mode 100644
index 000000000..bef6e5838
--- /dev/null
+++ b/Completion/Unix/Command/_trash
@@ -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