about summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix')
-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