Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #4 from godlikejay/master

fix colon in bash completion
  • Loading branch information...
commit 94b8f2abac73350660c8d0cd1d338f9f8c466429 2 parents aaad954 + 6360e75
Alon Horev authored January 05, 2013

Showing 1 changed file with 21 additions and 9 deletions. Show diff stats Hide diff stats

  1. 30  README.md
30  README.md
Source Rendered
@@ -28,7 +28,7 @@ Installation
28 28
 Install nosecomplete from pypi:
29 29
 
30 30
 	pip install nosecomplete
31  
-	
  31
+
32 32
 Follow @alonhorev on twitter for updates.
33 33
 
34 34
 bash
@@ -43,8 +43,8 @@ Add the following snippet to your .bashrc:
43 43
         # or bash-version >= 4 and COMP_WORDBREAKS contains a colon
44 44
         if [[
45 45
             "$1" == *:* && (
46  
-                ${BASH_VERSINFO[0]} -lt 4 || 
47  
-                (${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:*) 
  46
+                ${BASH_VERSINFO[0]} -lt 4 ||
  47
+                (${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:*)
48 48
             )
49 49
         ]]; then
50 50
             # Remove colon-word prefix from COMPREPLY items
@@ -55,10 +55,22 @@ Add the following snippet to your .bashrc:
55 55
             done
56 56
         fi
57 57
     } # __ltrim_colon_completions()
58  
-    
59  
-    _nosetests() 
  58
+
  59
+    _nosetests()
60 60
     {
61  
-        cur="${COMP_WORDS[COMP_CWORD]}"
  61
+        cur=${COMP_WORDS[COMP_CWORD]}
  62
+        if [[
  63
+                ${BASH_VERSINFO[0]} -lt 4 ||
  64
+                (${BASH_VERSINFO[0]} -ge 4 && "$COMP_WORDBREAKS" == *:*)
  65
+        ]]; then
  66
+            local i=$COMP_CWORD
  67
+            while [ $i -ge 0 ]; do
  68
+                [ ${COMP_WORDS[$((i--))]} == ":" ] && break
  69
+            done
  70
+            if [ $i -gt 0 ]; then
  71
+                cur=$(printf "%s" ${COMP_WORDS[@]:$i})
  72
+            fi
  73
+        fi
62 74
         COMPREPLY=(`nosecomplete ${cur} 2>/dev/null`)
63 75
         __ltrim_colon_completions "$cur"
64 76
     }
@@ -71,11 +83,11 @@ Add the following snippet to your .zshrc:
71 83
 
72 84
     autoload -U compinit
73 85
     compinit
74  
-    
  86
+
75 87
     autoload -U bashcompinit
76 88
     bashcompinit
77  
-    
78  
-    _nosetests() 
  89
+
  90
+    _nosetests()
79 91
     {
80 92
         cur="${COMP_WORDS[COMP_CWORD]}"
81 93
         COMPREPLY=(`nosecomplete ${cur} 2>/dev/null`)

0 notes on commit 94b8f2a

Please sign in to comment.
Something went wrong with that request. Please try again.