From 1199a033489427afe57f95d7b86438da73587904 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 28 Sep 2004 00:02:35 +0000 Subject: [PATCH] Some improvements suggested by Oliver. --- Completion/Unix/Command/_darcs | 21 +++++++++------------ 1 file 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