# HG changeset patch
# User Dmitriy Morozov <dmitriy@mrzv.org>
# Date 1284500154 25200
# Node ID e17bf1d5c28956daebfa3d3426b0babe39829e4a
# Parent  8befe33c55b13291635a207dc8a5f1bd38f3acf9# Parent  48cda0ae3913e4daabe5dc34345e994348407cad
Merged upstream

diff -r 48cda0ae3913 -r e17bf1d5c289 opster.py
--- a/opster.py	Sat Sep 11 10:39:15 2010 +0300
+++ b/opster.py	Tue Sep 14 14:35:54 2010 -0700
@@ -550,10 +550,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]
@@ -578,6 +582,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