# HG changeset patch # User catherine@dellzilla # Date 1236692884 14400 # Node ID 6dc79bf15fc64fdef2b99c965334ce551120714f # Parent f10bd1f0c7e31283b4e4e67d346dbbdca38269f4 trying move of shortcut expansion diff -r f10bd1f0c7e3 -r 6dc79bf15fc6 cmd2.py --- a/cmd2.py Mon Mar 09 20:48:20 2009 -0400 +++ b/cmd2.py Tue Mar 10 09:48:04 2009 -0400 @@ -482,10 +482,12 @@ p = raw else: s = self.inputParser.transformString(raw.lstrip()) + ''' for (shortcut, expansion) in self.shortcuts.items(): if s.lower().startswith(shortcut): s = s.replace(shortcut, expansion + ' ', 1) break + ''' result = self.parser.parseString(s) result['command'] = result.multilineCommand or result.command result['raw'] = raw @@ -512,6 +514,10 @@ """ if not line: return self.emptyline() + for (shortcut, expansion) in self.shortcuts.items(): + if line.lower().lstrip().startswith(shortcut): + line = line.replace(shortcut, expansion + ' ', 1) + break if not pyparsing.Or(self.commentGrammars).setParseAction(lambda x: '').transformString(line): return 0 # command was empty except for comments try: