Updated opster.py to 8befe33c55b1 default tip
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 08 Sep 2010 17:41:33 -0700
changeset 38 533043425d11
parent 37 29436a74b91b
Updated opster.py to 8befe33c55b1
opster.py
--- a/opster.py	Fri Sep 03 18:19:20 2010 -0700
+++ b/opster.py	Wed Sep 08 17:41:33 2010 -0700
@@ -242,7 +242,8 @@
 def help_options(options):
     yield 'options:\n\n'
     output = []
-    for short, name, default, desc in options:
+    for o in options:
+        short, name, default, desc = o[:4]
         if hasattr(default, '__call__'):
             default = default(None)
         default = default and ' (default: %s)' % default or ''
@@ -369,10 +370,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]