about summary refs log tree commit diff
diff options
context:
space:
mode:
authordana <dana@dana.is>2019-03-06 17:37:11 -0600
committerdana <dana@dana.is>2019-03-06 17:37:11 -0600
commita41f09f86206c281e7512f6e3b6e0ef944c20989 (patch)
treea138cfb1473da2678cfc66b0fdad4699624cc662
parent2055ee92e7e35a8de857d704d0abf71b6740f98f (diff)
downloadzsh-a41f09f86206c281e7512f6e3b6e0ef944c20989.tar.gz
zsh-a41f09f86206c281e7512f6e3b6e0ef944c20989.tar.xz
zsh-a41f09f86206c281e7512f6e3b6e0ef944c20989.zip
44099: Completion: Add _trash
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Darwin/Command/_trash22
2 files changed, 27 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5df6fecf5..b8406cdb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-06  dana  <dana@dana.is>
+
+	* 44099: Completion/Darwin/Command/_trash: Add completion for
+	macOS trash utility
+
 2019-03-01  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
 
 	* unposted: Test/ztst.zsh: fix a typo
diff --git a/Completion/Darwin/Command/_trash b/Completion/Darwin/Command/_trash
new file mode 100644
index 000000000..658716432
--- /dev/null
+++ b/Completion/Darwin/Command/_trash
@@ -0,0 +1,22 @@
+#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