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

PATCH: _ls, _chflags, _file_systems, _comm



Here are pathces for a few simple completion functions:

_ls, _chflags, _file_systems
     Support darwin (MacOSX)

_comm
     complete GNU options only if GNU version

I hope they have no problems.

===================================================================
diff -u zsh/Completion/Unix/Command/_ls zsh2/Completion/Unix/Command/_ls
--- zsh/Completion/Unix/Command/_ls     2006-05-25 16:58:07.000000000 +0900
+++ zsh2/Completion/Unix/Command/_ls    2007-09-12 00:09:01.000000000 +0900
@@ -5,7 +5,7 @@
 
 _pick_variant -r is_gnu gnu=gnu unix --help
 
-if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*) && "$is_gnu" != gnu ]]; then
+if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; then
   arguments=(
     '(-A)-a[list entries starting with .]'
     '(-a)-A[list all except . and ..]'
@@ -54,6 +54,13 @@
 
     '*:files:_files'
   )
+  if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then
+    arguments+=(
+      '-G[enable colorized output]'
+      '-H[follow symlinks on the command line]'
+      '-P[do not follow symlinks]'
+    )
+  fi
 else
   arguments=(
     '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]'

===================================================================
diff -u zsh/Completion/BSD/Command/_chflags zsh2/Completion/BSD/Command/_chflags 
--- zsh/Completion/BSD/Command/_chflags 2005-05-11 18:27:09.000000000 +0900
+++ zsh2/Completion/BSD/Command/_chflags        2007-09-09 23:39:32.000000000 +0900
@@ -25,7 +25,7 @@
   unset own
 fi
 
-if [[ $OSTYPE = (freebsd|dragonfly)* ]]; then
+if [[ $OSTYPE = (freebsd|dragonfly|darwin)* ]]; then
   flags=( $flags[@]
     '(nouunlnk)uunlnk[set the user undeletable flag]'
     '(uunlnk)nouunlnk[unset the user undeletable flag]'

===================================================================
diff -u zsh/Completion/Unix/Type/_file_systems zsh2/Completion/Unix/Type/_file_systems
--- zsh/Completion/Unix/Type/_file_systems      2005-06-08 21:45:35.000000000 +0900
+++ zsh2/Completion/Unix/Type/_file_systems     2007-09-11 23:01:53.000000000 +0900
@@ -20,6 +20,10 @@
     fss=( cd9660 devfs ext2fs fdesc kernfs linprocfs mfs msdos nfs 
           ntfs null nwfs portal procfs std udf ufs umap union )
   ;;
+  darwin*)
+    fss=( afp cd9660 cddafs devfs fdesc hfs lfs msdos nfs
+          ntfs smbfs synthfs udf ufs volfs webdav )
+  ;;
   *)
     # default for all other systems
     fss=( ufs )

===================================================================
diff -u zsh/Completion/Unix/Command/_comm zsh2/Completion/Unix/Command/_comm
--- zsh/Completion/Unix/Command/_comm   2007-03-12 09:02:11.000000000 +0900
+++ zsh2/Completion/Unix/Command/_comm  2007-09-08 01:04:19.000000000 +0900
@@ -1,10 +1,20 @@
 #compdef comm
 
-_arguments -s \
-  '-1[suppress lines unique to FILE1]' \
-  '-2[suppress lines unique to FILE2]' \
-  '-3[suppress lines that appear in both files]' \
-  '--help' \
-  '--version' \
-  '1:file1 to compare:_files' \
+local -a args
+
+args=(
+  '-1[suppress lines unique to FILE1]'
+  '-2[suppress lines unique to FILE2]'
+  '-3[suppress lines that appear in both files]'
+  '1:file1 to compare:_files'
   '2:file2 to compare:_files'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  args+=(
+    '(- : *)--version[display version information]'
+    '(- : *)--help[display help information]'
+  )
+fi
+
+_arguments -s $args



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