[ditz-talk] [PATCH] simplify bash completion

Christian Garbs mitch at cgarbs.de
Fri Aug 29 16:51:47 EDT 2008


---
 contrib/completion/ditz.bash |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/contrib/completion/ditz.bash b/contrib/completion/ditz.bash
index 4a17c72..89f047f 100644
--- a/contrib/completion/ditz.bash
+++ b/contrib/completion/ditz.bash
@@ -9,13 +9,10 @@ _ditz()
     local cur=${COMP_WORDS[COMP_CWORD]}
     if [ $COMP_CWORD -eq 1 ]; then
 	COMPREPLY=( $( compgen -W "$(ditz --commands)" -- $cur ) )
-    elif [ $COMP_CWORD -eq 2 ]; then
-	local cmd=${COMP_WORDS[1]}
-	COMPREPLY=( $( compgen -W "$(ditz "$cmd" '<options>' 2>/dev/null)" -- $cur ) )
-    elif [ $COMP_CWORD -eq 3 ]; then
-	local cmd=${COMP_WORDS[1]}
-	local parm1=${COMP_WORDS[2]}
-	COMPREPLY=( $( compgen -W "$(ditz "$cmd" "$parm1" '<options>' 2>/dev/null)" -- $cur ) )
+    else
+	unset COMP_WORDS[COMP_CWORD]  # remove last
+	unset COMP_WORDS[0]           # remove first
+	COMPREPLY=( $( compgen -W "$(ditz "${COMP_WORDS[@]}" '<options>' 2>/dev/null)" -- $cur ) )
     fi 
 }
 
-- 
1.5.6.3




More information about the ditz-talk mailing list