Merged upstream
authorDmitriy Morozov <dmitriy@mrzv.org>
Fri, 01 Oct 2010 09:45:26 -0700
changeset 122 76334dcc9ae4
parent 117 e17bf1d5c289 (diff)
parent 121 836bb50a8660 (current diff)
child 132 b072cb473b47
Merged upstream
opster.py
--- a/opster.py	Sun Sep 19 20:17:49 2010 +0300
+++ b/opster.py	Fri Oct 01 09:45:26 2010 -0700
@@ -532,10 +532,14 @@
         print ' '.join(filter(lambda x: x.startswith(current), commands))
 
     # command options
-    elif cwords[0] in commands:
+    else:
+        try:
+            aliases, (cmd, opts, usage) = findcmd(cwords[0], cmdtable)
+        except AmbiguousCommand:
+            sys.exit(1) 
+
         idx = -2 if current else -1
         options = []
-        aliases, (cmd, opts, usage) = findcmd(cwords[0], cmdtable)
 
         for o in opts:
             short, long, default, help = o[:4]
@@ -560,6 +564,7 @@
     COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\
                    COMP_CWORD=$COMP_CWORD \\
                    OPSTER_AUTO_COMPLETE=1 $1 ) )
+    COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
 }
 complete -o default -F _opster_completion %s
 # opster bash completion end