about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-08-20 10:41:51 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-08-20 10:41:51 +0000
commitea412fbe4b639a71eea54b9daaf3b64c750ef763 (patch)
tree3d45bda66345b7d261d14d989b992a91b5ad04e7
parentbaa21b02adbc4151c99c372d69c03903ec90a38b (diff)
downloadzsh-ea412fbe4b639a71eea54b9daaf3b64c750ef763.tar.gz
zsh-ea412fbe4b639a71eea54b9daaf3b64c750ef763.tar.xz
zsh-ea412fbe4b639a71eea54b9daaf3b64c750ef763.zip
18949: new completion for du
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/.distfiles2
-rw-r--r--Completion/Unix/Command/_du44
-rw-r--r--Completion/Unix/Type/_directories2
4 files changed, 50 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 571ea515e..0f80fd7c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,10 @@
 
 2003-08-20  Oliver Kiddle  <opk@zsh.org>
 
-	* 18947: Completion/Unix/Command/_chown: also complete options using
+	* 18949: Completion/Unix/Command/_du,
+	Completion/Unix/Type/_directories: new completion for du
+
+ 	* 18947: Completion/Unix/Command/_chown: also complete options using
 	_arguments
 
 2003-08-19  Adam Spiers  <adam@spiers.net>
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 18599156d..66458d5fa 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -21,5 +21,5 @@ _netcat       _larch        _texinfo	  _figlet       _elinks       _tidy
 _global                     _ant          _lsof         _mt           _xmlsoft
 _perforce     _python       _antiword     _screen       _renice       _apm
 _ecasound     _gpg	    _subversion   _aap          _sablotron    _nmap
-_chmod
+_chmod        _du
 '
diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du
new file mode 100644
index 000000000..167fc9895
--- /dev/null
+++ b/Completion/Unix/Command/_du
@@ -0,0 +1,44 @@
+#compdef du
+
+if _pick_variant gnu=Free\ Soft unix --version; then
+  _arguments -s \
+    '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \
+    '--apparent-size[print apparent sizes rather than disc usage]' \
+    '(-B --block-size -k)'{-B,--block-size=}'[specify block size]:size (bytes)' \
+    '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \
+    '(-c --total)'{-c,--total}'[produce a grand total]' \
+    '(-D --dereference-args -L --dereference)'{-D,--dereference-args}'[dereference arguments that are symlinks]' \
+    '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes in human readable format]' \
+    '(-H --si -h --human-readable)'{-H,--si}'[human readable form using powers of 1000]' \
+    '(-B --block-size)-k[use block size of 1k]' \
+    '(-l --count-links)'{-l,--count-links}'[count sizes many times if hard linked]' \
+    '(-L --dereference -D --dereference-args)'{-L,--dereference}'[dereference all symlinks]' \
+    '(-S --separate-dirs)'{-S,--seperate-dirs}'[do not include size of subdirectories]' \
+    '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only display total for each argument]' \
+    '(-x --one-file-system)'{-x,--one-file-system}'[skip directories on different filesystems]' \
+    \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \
+    '*--exclude=[exclude files matching pattern]:pattern' \
+    '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \
+    '(* -)--help[display help information]' \
+    '(* -)--version[display version information]' \
+    '*:file:_files'
+  return
+else
+  # based on $OSTYPE = solaris2.8
+  local xdev='[skip directories on different filesystems]'
+  if [[ ${commands[$words[1]]:-$words[1]} = *xpg4* ]]; then
+    args=( -x$xdev )
+  else
+    args=( -d$xdev
+      '-L[dereference symlinks]'
+      "(-a)-o[do not add child directories' usage to parent's total]"
+    )
+  fi
+  _arguments -s "$args[@]" \
+    '(-s -o)-a[write counts for all files]' \
+    '-k[use block size of 1k]' \
+    '-r[notify about unreadable files/directories]' \
+    '(-a)-s[only display total for each argument]' \
+    '*:file:_files'
+  return
+fi
diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories
index 6cc7aa3f8..ab1b50b4f 100644
--- a/Completion/Unix/Type/_directories
+++ b/Completion/Unix/Type/_directories
@@ -1,4 +1,4 @@
-#compdef rmdir df du dircmp -P -value-,*path,-default-
+#compdef rmdir df dircmp -P -value-,*path,-default-
 
 local expl