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

[PATCH] update _ls



Solaris:
I assume -S and -k are supported,
and -b does not use C-escape but octal.
Am I correct?

BSDs:
dragonfly/freebsd ignores -g
openbsd doesn't have -b -B -w, but has -H
dragonfly has -G -P -H
new option -W (except on openbsd)
several new options specific to each of netbsd/freebsd/darwin

Linux:
--ignore/-I/--hide can be specified multiple times
-H is not a synonym of --si (but of --dereference-command-line)
-p is not a synonym of --file-type



diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index ca20107..955b089 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -11,10 +11,10 @@ if ! _pick_variant gnu=gnu unix --help; then
     '-R[list subdirectories recursively]'
 
     '(-k)-h[print sizes in human readable form]'
+    '(-h)-k[print sizes in kilobytes]'
 
     '-i[print file inode numbers]'
     '(-l -g -1 -C -m -x)-l[long listing]'
-    '(-l -1 -C -m -x)-g[long listing but without owner information]'
     '(-l -g -C -m -x)-1[single column output]'
     '(-l -g -1 -m -x)-C[list entries in columns sorted vertically]'
     '(-l -g -1 -C -x)-m[comma separated]'
@@ -27,6 +27,7 @@ if ! _pick_variant gnu=gnu unix --help; then
 
     '-r[reverse sort order]'
 
+    '(-t)-S[sort by size]'
     '(-S)-t[sort by modification time]'
 
     '(-p)-F[append file type indicators]'
@@ -34,31 +35,80 @@ if ! _pick_variant gnu=gnu unix --help; then
 
     '-n[numeric uid, gid]'
 
-    '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]'
     '(-B -b -w -q)-q[hide control chars]'
 
     '*:files:_files'
   )
   if [[ "$OSTYPE" = (netbsd*|dragonfly*|freebsd*|openbsd*|darwin*) ]]; then
     arguments+=(
-      '(-h)-k[print sizes of 1k]'
-      '(-t)-S[sort by size]'
       '-T[show complete time information]'
-      '-o[display file flags]'
-      '-f[output is not sorted]'
-      '(-B -b -w -q)-w[print raw characters]'
+      '(-a -A -r -S -t)-f[output is not sorted]'
+    )
+  fi
+  if [[ $OSTYPE = (netbsd*|dragonfly*|freebsd*|openbsd*) ]]; then
+    arguments+=( '-o[display file flags]' )
+  fi
+  if [[ $OSTYPE = (netbsd*|dragonfly*|freebsd*|darwin*) ]]; then
+    arguments+=(
       '(-B -b -w -q)-B[print octal escapes for control characters]'
+      '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]'
+      '(-B -b -w -q)-w[print raw characters]'
+      '-W[display whiteouts when scanning directories]'
     )
   fi
-  if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then
+  if [[ $OSTYPE = (netbsd*|openbsd*|darwin*|solaris*) ]]; then
+    arguments+=(
+      '(-l -1 -C -m -x)-g[long listing but without owner information]'
+    )
+  fi
+  if [[ $OSTYPE = netbsd* ]]; then
+    arguments+=(
+      '-M[output file sizes in comma-separated form]'
+      '-O[output only leaf (non-directory) files]'
+      '-P[print full pathname for each file]'
+      "-X[don't cross mount points when recursing]"
+    )
+  fi
+  if [[ $OSTYPE = (dragonfly*|freebsd*|openbsd*|darwin*) ]]; then
+    arguments+=( '-H[follow symlinks on the command line]' )
+  fi
+  if [[ $OSTYPE = (dragonfly*|freebsd*|darwin*) ]]; then
     arguments+=(
       '-G[enable colorized output]'
-      '-H[follow symlinks on the command line]'
       '-P[do not follow symlinks]'
     )
   fi
+  if [[ $OSTYPE = (dragonfly*|freebsd*) ]]; then
+    arguments+=(
+      '(-A)-I[prevent -A from being automatically set for the super-user]'
+    )
+  fi
+  if [[ $OSTYPE = dragonfly* ]]; then
+    arguments+=( '-y[display FSMID in long listing]' )
+  fi
+  if [[ $OSTYPE = (freebsd*|darwin*) ]]; then
+    arguments+=( '(-c -u)-U[file creation time]' )
+  fi
+  if [[ $OSTYPE = freebsd* ]]; then
+    arguments+=(
+      '-,[print file sizes grouped and separated by thousands]'
+      '-D+[specify format for date]:format: _date_formats'
+      '-y[with -t, sort filenames in the same order as the time]'
+      '-Z[display MAC label]'
+    )
+  fi
+  if [[ $OSTYPE = darwin* ]]; then
+    arguments+=(
+      '-@[display extended attribute keys and sizes in long listing]'
+      '-e[display ACL in long listing]'
+      '(-l -1 -C -m -x)-o[long listing but without group information]'
+      '-O[display file flags]'
+      '-v[print raw characters]'
+    )
+  fi
   if [[ $OSTYPE = solaris* ]]; then
     arguments+=(
+      '(-q)-b[print octal escapes for control characters]'
       '(-l -1 -C -m -x)-o[long listing but without group information]'
       '(-l -t -s -r -a)-f[interpret each argument as a directory]'
       '(-E -l)-e[long listing with full and consistent date/time]'
@@ -78,14 +128,15 @@ else
     '(--ignore-backups -B)'{--ignore-backups,-B}"[don't list entries ending with ~]"
     '(--directory -d)'{--directory,-d}'[list directory entries instead of contents]'
     '(--dired -D)'{--dired,-D}"[generate output designed for Emacs' dired mode]"
-    '(--ignore -I)'{--ignore,-I}"[don't list entire matching pattern]:pattern:"
-    '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]'
-    '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference-command-line,--dereference-command-line-symlink-to-dir}
+    '*'{--ignore=,-I+}"[don't list entries matching pattern]:pattern: "
+    '(--dereference -L --dereference-command-line -H --dereference-command-line-symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]'
+    '(--dereference -L --dereference-command-line -H --dereference-command-line-symlink-to-dir)'{--dereference-command-line,-H}'[follow symlink on the command line]'
+    '(--dereference -L --dereference-command-line -H)'--dereference-command-line-symlink-to-dir
     '(--recursive -R)'{--recursive,-R}'[list subdirectories recursively]'
 
     '(--no-group -G)'{--no-group,-G}'[inhibit display of group information]'
-    '(--human-readable -h -H --si)'{--human-readable,-h}'[print sizes in human readable form]'
-    '(--si -H -h --human-readable)'{--si,-H}'[sizes in human readable form; powers of 1000]'
+    '(--block-size --human-readable -h --si --kilobytes -k)'{--human-readable,-h}'[print sizes in human readable form]'
+    '(--block-size --human-readable -h --si --kilobytes -k)--si[sizes in human readable form; powers of 1000]'
     '(--inode -i)'{--inode,-i}'[print file inode numbers]'
 
     '(--format -l -g -o -1 -C -m -x)-l[long listing]'
@@ -96,7 +147,7 @@ else
     '(--format -l -g -o -1 -m -x)-C[list entries in columns sorted vertically]'
     '(--format -l -g -o -1 -C -x)-m[comma separated]'
     '(--format -l -g -o -1 -C -m)-x[sort horizontally]'
-    '(-l -g -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)'
+    '(-l -g -o -1 -C -m -x)--format=[specify output format]:format:(verbose long commas horizontal across vertical single-column)'
 
     '(--size -s -f)'{--size,-s}'[display size of each file in blocks]'
 
@@ -106,25 +157,26 @@ else
     '--time-style=[show times using specified style]:style: _alternative "time-styles\:time style\:(full-iso long-iso iso locale)" $datef'
 
     '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, short list]'
-    '(--reverse)'{--reverse,-r}'[reverse sort order]'
+    '(--reverse -r -U -f)'{--reverse,-r}'[reverse sort order]'
 
     '(--sort -t -U -v -X)-S[sort by size]'
     '(--sort -S -U -v -X)-t[sort by modification time]'
     '(--sort -S -t -v -X)-U[unsorted]'
     '(--sort -S -t -U -X)-v[sort by version (filename treated numerically)]'
     '(--sort -S -t -U -v)-X[sort by extension]'
-    '(-S -t -U -v -X)--sort=:sort:(size time none version extension)'
+    '(-S -t -U -v -X)--sort=[specify sort key]:sort key:(size time none version extension)'
 
     '--color=-[control use of color]:color:(never always auto)'
-    "--hide=[don't list entries matching pattern]:pattern"
+    "*--hide=[like -I, but overridden by -a or -A]:pattern: "
     '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]'
-    '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append file type indicators except *]'
-    '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify slash)'
+    '(--file-type -p --indicator-style -F --classify)--file-type[append file type indicators except *]'
+    '(--file-type -p --indicator-style -F --classify)-p[append / to directories]'
+    '(-F --classify -p --file-type)--indicator-style=[specify indicator style]:indicator style:(none file-type classify slash)'
 
     '(-f)--full-time[list both full date and full time]'
 
-    '(--kilobytes -k --block-size)'{--kilobytes,-k}'[use block size of 1k]'
-    '(-k --kilobytes)--block-size=[specify block size]:block size (bytes):(1024)'
+    '(--block-size --human-readable -h --si --kilobytes -k)'{--kilobytes,-k}'[use block size of 1k]'
+    '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(1024)'
 
     '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]'
     '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size'
@@ -133,7 +185,7 @@ else
     '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-b}'[print octal escapes for control characters]'
     '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print entry names without quoting]'
     '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-Q}'[quote names]'
-    '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)'
+    '(-b --escape -N --literal -Q --quote-name)--quoting-style=[specify quoting style]:quoting style:(literal shell shell-always c escape clocale locale)'
 
     '(--hide-control-chars -q --show-control-chars)'{--hide-control-chars,-q}'[hide control chars]'
     '(-q --hide-control-chars)--show-control-chars'
@@ -148,4 +200,4 @@ else
   fi
 fi
 
-_arguments -s $arguments
+_arguments -s -S : $arguments





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