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

PATCH: minor fix for _uniq



Minor changes to the completion for 'uniq'.

Added an option -i for MacOSX (darwin) and freebsd,
and options -z/--zero-terminated for Gnu version.

I could not find options -t/--separator and -W/--check-fields in
my Linux boxes, but I didn't remove them.


Index: Completion/Unix/Command/_uniq
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_uniq,v
retrieving revision 1.1
diff -u -r1.1 _uniq
--- Completion/Unix/Command/_uniq	23 Feb 2004 17:03:31 -0000	1.1
+++ Completion/Unix/Command/_uniq	5 Sep 2012 13:28:26 -0000
@@ -13,12 +13,17 @@
   '(-u --unique)'{-u,--unique}'[only print unique lines]'
   '(-w --check-chars)'{-w,--check-chars=}'[specify maximum number of characters to compare]:characters'
   '(-W --check-fields)'{-W,--check-fields=}'[specify maximum number of fields to compare]:fields'
+  '(-z --zero-terminated)'{-z,--zero-terminated}'[delimit lines with null character, not newline]'
   '(- *)--help[display help information]'
   '(- *)--version[display version information]'
 )
 
 if ! _pick_variant gnu=Free\ Soft unix --version; then
-  args=( ${(M)args:#(|\*)(|\(*\))-[cdufs]*} )
+  local optchars="cdufs"
+  if [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
+    optchars="${optchars}i"
+  fi
+  args=( ${(M)args:#(|\*)(|\(*\))-[$optchars]*} )
 fi
 
 _arguments "$args[@]" \




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