Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: update macos completions



- Add support for native macos trash command added in macOS 14.0 (per `man trash`)
- Add `hostname -d` flag (added in macOS 12.3 / shell_cmds-240.100.15)

[I'd like to have _trash refuse to repeat filenames, just like _git-add, but that's quite beyond my skill at this point]

diff --git a/Completion/Unix/Command/_hostname b/Completion/Unix/Command/_hostname
index 40a3189ae..2f6187e28 100644
--- a/Completion/Unix/Command/_hostname
+++ b/Completion/Unix/Command/_hostname
@@ -45,10 +45,6 @@ case $variant in
   darwin*|freebsd*)
     args+=(
       '(: -d -s)-f[display host name with DNS domain (FQDN)]'
-    )
-    ;| # MATCH AGAIN
-  freebsd*)
-    args+=(
       '(: -f -s)-d[display DNS domain only]'
     )
     ;;
diff --git a/Completion/Unix/Command/_trash b/Completion/Unix/Command/_trash
index bef6e5838..64ef69385 100644
--- a/Completion/Unix/Command/_trash
+++ b/Completion/Unix/Command/_trash
@@ -2,7 +2,7 @@

 local variant

-_pick_variant -r variant ali='(Rantakari|hasseg)' steven='(Steven|vanZyl)' other --version
+_pick_variant -r variant ali='(Rantakari|hasseg)' steven='(Steven|vanZyl)' darwin='stopOnError' other --help

 case $variant in
   ali)
@@ -53,5 +53,21 @@ case $variant in
     _arguments -s -S : $args
     return
     ;;
+  darwin)
+    local -a args=(
+      '(-v --verbose)'{-v,--verbose}'[display more verbose status]'
+
+      + options
+      '(-s --stopOnError)'{-s,--stopOnError}'[exit with an error if any move to a trash folder fails]'
+
+      + info
+      '(- *)'{-h,--help}'[display help information]'
+
+      + input
+      '(actions)*: :_files'
+    )
+    _arguments -A : $args
+    return
+    ;;
   *) _default ;;
 esac



Messages sorted by: Reverse Date, Date, Thread, Author