comparison cmd2.py @ 347:432ccab7c6c8

going to try moving output redirection to outside precmd, postcmd hooks
author catherine@Drou
date Tue, 16 Feb 2010 16:33:47 -0500
parents 49dd1ce6cfd6
children 09145e5d7c26
comparison
equal deleted inserted replaced
346:49dd1ce6cfd6 347:432ccab7c6c8
757 commands by the interpreter should stop. 757 commands by the interpreter should stop.
758 758
759 This (`cmd2`) version of `onecmd` already override's `cmd`'s `onecmd`. 759 This (`cmd2`) version of `onecmd` already override's `cmd`'s `onecmd`.
760 760
761 """ 761 """
762 # TODO: output from precmd and postcmd goes untrapped... and I don't
763 # know how to fix it...
762 if not line: 764 if not line:
763 return self.emptyline() 765 return self.emptyline()
764 if not pyparsing.Or(self.commentGrammars).setParseAction(lambda x: '').transformString(line): 766 if not pyparsing.Or(self.commentGrammars).setParseAction(lambda x: '').transformString(line):
765 return 0 # command was empty except for comments 767 return 0 # command was empty except for comments
766 try: 768 try: