changeset 237:e91808980e59

fixed bug in abbreviated commands
author catherine@dellzilla
date Tue, 24 Mar 2009 14:11:49 -0400
parents 035330ccfcf0
children 0bae9aaf331a
files cmd2.py
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/cmd2.py	Tue Mar 24 13:59:00 2009 -0400
+++ b/cmd2.py	Tue Mar 24 14:11:49 2009 -0400
@@ -283,8 +283,7 @@
         self.stdout.write("""
         Commands are %(casesensitive)scase-sensitive.
         Commands may be terminated with: %(terminators)s
-        Settable parameters: %(settable)s
-        """ % 
+        Settable parameters: %(settable)s\n""" % \
         { 'casesensitive': (self.case_insensitive and 'not ') or '',
           'terminators': str(self.terminators),
           'settable': ' '.join(self.settable)
@@ -624,10 +623,10 @@
             except AttributeError:
                 func = None
                 if self.abbrev:   # accept shortened versions of commands
-                    funcs = [f for (fname, function) in inspect.getmembers(self, inspect.ismethod) 
+                    funcs = [(fname, function) for (fname, function) in inspect.getmembers(self, inspect.ismethod) 
                              if fname.startswith('do_' + statement.parsed.command)]
                     if len(funcs) == 1:
-                        func = funcs[0]
+                        func = funcs[0][1]
                 if not func:
                     return self.postparsing_postcmd(self.default(statement))                
             timestart = datetime.datetime.now()
@@ -809,8 +808,6 @@
             self.pystate[self.nonpythoncommand] = onecmd
             try:
                 interp.interact()
-            except SystemExit:
-                quit()
             except EmbeddedConsoleExit:
                 return