Package: python-doit
Version: 0.21.1-1
Severity: important
Tags: upstream patch

Hi,

The doit completion script overwrites COMP_WORDBREAKS, adversely
affecting other completion scripts.  Luckily the _get_comp_words_by_ref
helper from bash-completion can be used to avoid this, in effect
overwriting COMP_WORDBREAKS locally (by pasting words together).

How about this patch?

Hope that helps,
Jonathan

 bash_completion_doit | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/bash_completion_doit b/bash_completion_doit
index 51f76858..5fb2342e 100644
--- a/bash_completion_doit
+++ b/bash_completion_doit
@@ -3,11 +3,9 @@
 
 _doit()
 {
-    local cur prev basetask sub_cmds tasks i dodof
+    local cur prev words cword basetask sub_cmds tasks i dodof
     COMPREPLY=()
-    COMP_WORDBREAKS=${COMP_WORDBREAKS//:} # remove colon from word separator 
list
-    cur="${COMP_WORDS[COMP_CWORD]}"
-    prev="${COMP_WORDS[COMP_CWORD-1]}"
+    _get_comp_words_by_ref -n : cur prev words cword
     # list of doit sub-commands
     sub_cmds="help run clean list forget ignore auto dumpdb"
 
@@ -28,14 +26,14 @@ _doit()
 
 
     # get name of the dodo file
-    for (( i=0; i < ${#COMP_WORDS[@]}; i++)); do
-        case "${COMP_WORDS[i]}" in
+    for (( i=0; i < ${#words[@]}; i++)); do
+        case "${words[i]}" in
         -f)
-            dodof=${COMP_WORDS[i+1]}
+            dodof=${words[i+1]}
             break
             ;;
         --file=*)
-            dodof=${COMP_WORDS[i]/*=/}
+            dodof=${words[i]/*=/}
             break
             ;;
         esac
@@ -64,7 +62,7 @@ _doit()
 
     # match for first parameter must be sub-command or task
     # FIXME doit accepts options "-" in the first parameter but we ignore this 
case
-    if [[ ${COMP_CWORD} == 1 ]] ; then
+    if [[ ${cword} == 1 ]] ; then
         COMPREPLY=( $(compgen -W "${sub_cmds} ${tasks}" -- ${cur}) )
         return 0
     fi
-- 
1.8.3


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to