# HG changeset patch # User devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil # Date 1198081813 18000 # Node ID 25f22e742a6827f630ea31cfaabcf88807943edf # Parent d0f0b3e0b89bc00db9d6934c82192bea40bb385a statement ends fixed diff -r d0f0b3e0b89b -r 25f22e742a68 cmd2.py --- a/cmd2.py Wed Dec 19 11:12:25 2007 -0500 +++ b/cmd2.py Wed Dec 19 11:30:13 2007 -0500 @@ -85,14 +85,12 @@ # but statementHasEnded needs a string arg; anyway, we're getting # user input and users are slow. + statementEndPattern = re.compile(r'[\n;]\s*$') def statementHasEnded(self, lines): """This version lets statements end with ; or with a blank line. Override for your own needs.""" - print '>%s<' % (lines.splitlines()[-1]) - if not lines.splitlines()[-1].strip(): - return True - return (lines.strip()[-1] == ';') - + return bool(self.statementEndPattern.search(lines)) + def do_history(self, arg): """history [arg]: lists past commands issued