diff cmd2.py @ 228:68b444aeaf8b

now abbrevs and synonyms do not clash
author catherine@Elli.myhome.westell.com
date Mon, 23 Mar 2009 08:32:03 -0400
parents 82b6e0881b78
children caa475678e24
line wrap: on
line diff
--- a/cmd2.py	Mon Mar 23 05:54:43 2009 -0400
+++ b/cmd2.py	Mon Mar 23 08:32:03 2009 -0400
@@ -588,18 +588,18 @@
                     self.stdout.write(getPasteBuffer())
         try:
             # "heart" of the command, replace's cmd's onecmd()
-            self.lastcmd = statement.parsed.expanded
-            if self.abbrev:   # accept shortened versions of commands
-                funcs = [func for (fname, func) in inspect.getmembers(self, inspect.ismethod) 
-                         if fname.startswith('do_' + statement.parsed.command)]
-                if len(funcs) == 1:
-                    func = funcs[0]
-                else:
-                    return self.postparsing_postcmd(self.default(statement))                
-            else:
-                try:
-                    func = getattr(self, 'do_' + statement.parsed.command)
-                except AttributeError:
+            self.lastcmd = statement.parsed.expanded   
+            try:
+                func = getattr(self, 'do_' + statement.parsed.command)
+            except AttributeError:
+                func = None
+                if self.abbrev:   # accept shortened versions of commands
+                    funcs = [func for (fname, func) in inspect.getmembers(
+                                                       self, inspect.ismethod) 
+                             if fname.startswith('do_' + statement.parsed.command)]
+                    if len(funcs) == 1:
+                        func = funcs[0]
+                if not func:
                     return self.postparsing_postcmd(self.default(statement))                
             timestart = datetime.datetime.now()
             stop = func(statement)