retitle 546725 please update bash completion
tags 546725 patch
thanks

Hello,
the bash completion of cowbuilder is kinda broken. I'm attaching a patch
updating the completion file to use the latest bash-completion helpers (e.g.
_get_comp_words_by_ref); it would be nice if you could update it in the package.

Thank you,
David

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://deb.li/dapal
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
--- ../cowbuilder.orig	2011-03-16 23:12:54.000000000 +0100
+++ cowbuilder	2011-03-16 23:28:50.000000000 +0100
@@ -1,6 +1,6 @@
-#!/bin/bash
 # Debian GNU/Linux cowbuilder(1) completion
 # Copyright 2007 Cyril Brulebois <cyril.bruleb...@enst-bretagne.fr>
+# Copyright 2011 David Paleino <da...@debian.org>
 #
 # This script can be distributed under the same license as the
 # cowdancer or bash packages.
@@ -8,39 +8,42 @@
 have cowbuilder &&
 _cowbuilder()
 {
-    local initialcommand initialcommand_options cur prev other_options distribution
+    local initialcommand initialcommand_options cur prev words other_options distribution
 
     COMPREPLY=()
-    cur=$(_get_cword)
-    prev=${COMP_WORDS[COMP_CWORD-1]}
-    initialcommand=${COMP_WORDS[1]}
+    _get_comp_words_by_ref cur prev words
+    initialcommand=${words[1]}
     initialcommand_options='--create --update --build --login --execute'
     other_options='--dumpconfig --distribution --mirror --basepath --architecture'
     distribution='sid sarge etch woody lenny squeeze'
 
+    case $prev in
+	--distribution)
+	    COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur"  ) )
+	    return 0
+	    ;;
+	--basepath)
+	    _filedir -d
+	    return 0
+	    ;;
+	*)
+	    ;;
+    esac
+
     case $initialcommand in
         --build)
-            COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) 
-		$( compgen -o filenames -G "$cur*.dsc" ) )
+            COMPREPLY=( $( compgen -W "$other_options" -- "$cur" )
+                        $( compgen -o filenames -G "$cur*.dsc" ) )
             ;;
         --execute)
-            COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) 
-		$( compgen -o filenames -G "$cur*" ) )
+            COMPREPLY=( $( compgen -W "$other_options" -- "$cur" )
+                        $( compgen -o filenames -G "$cur*" ) )
             ;;
         *)
-            COMPREPLY=( $( compgen -W "$initialcommand_options" | grep "^$cur" ) 
-		$( compgen -W "$other_options" | grep "^$cur" ) 
-		)
+            COMPREPLY=( $( compgen -W "$initialcommand_options $other_options" -- "$cur" ) )
             ;;
     esac
 
-    case $prev in
-	--distribution)
-	    COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur"  ) )
-	    ;;
-	*)
-    esac
-
     return 0
-}
-[ "$have" ] && complete -F _cowbuilder -o filenames cowbuilder
+} &&
+complete -F _cowbuilder cowbuilder

Attachment: signature.asc
Description: PGP signature

Reply via email to