about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2004-09-28 00:02:35 +0000
committerWayne Davison <wayned@users.sourceforge.net>2004-09-28 00:02:35 +0000
commit1199a033489427afe57f95d7b86438da73587904 (patch)
tree5491bb1159b02829a7fb56b52d49f7f1230cd365
parentdb7e23754d3bdf97ea8a3792ae071b47406ea027 (diff)
downloadzsh-1199a033489427afe57f95d7b86438da73587904.tar.gz
zsh-1199a033489427afe57f95d7b86438da73587904.tar.xz
zsh-1199a033489427afe57f95d7b86438da73587904.zip
Some improvements suggested by Oliver.
-rw-r--r--Completion/Unix/Command/_darcs21
1 files changed, 9 insertions, 12 deletions
diff --git a/Completion/Unix/Command/_darcs b/Completion/Unix/Command/_darcs
index d5856fe32..7aa57643b 100644
--- a/Completion/Unix/Command/_darcs
+++ b/Completion/Unix/Command/_darcs
@@ -1,14 +1,11 @@
 #compdef darcs
 
-_darcs() {
-    # 1 based array
-    if (($CURRENT == 2)); then
-        compadd -- $( darcs --commands | grep "^$PREFIX" )
-        return 0
-    fi
-
-    compadd -- $( darcs ${words[2]} --list-option |  grep "^$PREFIX" )
-    return 0
-}
-
-_darcs "$@"
+if (($CURRENT == 2)); then
+  # We're completing the first word after "darcs" -- the command.
+  _wanted command expl 'darcs command' \
+    compadd -- $( darcs --commands )
+else
+  # Find the options/files/URL/etc. for the current command by using darcs.
+  _wanted args expl 'arg for darcs command' \
+    compadd -- $( darcs ${words[2]} --list-option )
+fi