# HG changeset patch # User catherine@Drou # Date 1266273952 18000 # Node ID f69211e2c5702199cea980acc451e8c3f434d1da # Parent 99dd71cb477a4b06967fac8fc4399dd73bea471c tweaks for sqlpython compatibility diff -r 99dd71cb477a -r f69211e2c570 cmd2.py --- a/cmd2.py Fri Feb 12 23:29:19 2010 -0500 +++ b/cmd2.py Mon Feb 15 17:45:52 2010 -0500 @@ -1256,6 +1256,11 @@ result = runner.run(testcase) result.printErrors() + def run_commands_at_invocation(self, callargs): + for initial_command in callargs: + if self.onecmd(initial_command + '\n') == app._STOP_AND_EXIT: + return + def cmdloop(self): parser = optparse.OptionParser() parser.add_option('-t', '--test', dest='test', @@ -1265,11 +1270,7 @@ if callopts.test: self.runTranscriptTests(callargs) else: - # hold onto the args and run .onecmd with them - # in sqlpython, first arg has implied \connect - for initial_command in callargs: - if self.onecmd(initial_command + '\n') == app._STOP_AND_EXIT: - return + self.run_commands_at_invocation(callargs) self._cmdloop() class HistoryItem(str):