diff options
author | catherine <catherine@dellzilla> | 2009-03-24 13:59:00 -0400 |
---|---|---|
committer | catherine <catherine@dellzilla> | 2009-03-24 13:59:00 -0400 |
commit | b9f5b3f28222f03acb7816c0cac55eab321090d5 (patch) | |
tree | 9169b985a8988aab2e050686d7eaa8aaa78e4ddd | |
parent | 773deb9e970ac6910bfad0e794914cd5c491a230 (diff) | |
download | cmd2-hg-b9f5b3f28222f03acb7816c0cac55eab321090d5.tar.gz |
py really working right now
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -792,8 +792,7 @@ class Cmd(cmd.Cmd): def do_py(self, arg): ''' py <command>: Executes a Python command. - py: Enters interactive Python mode; end with `Ctrl-D`. - Do not end with Ctrl-Z, or it will end your entire cmd2 session! + py: Enters interactive Python mode; end with `Ctrl-D`, `quit()`, or 'exit`. Non-python commands can be issued with cmd('your non-python command here'). ''' if arg.strip(): @@ -803,9 +802,11 @@ class Cmd(cmd.Cmd): interp = MyInteractiveConsole(locals=self.pystate) def quit(): raise EmbeddedConsoleExit + def onecmd(arg): + return self.onecmd(arg + '\n') self.pystate['quit'] = quit self.pystate['exit'] = quit - self.pystate[self.nonpythoncommand] = self.onecmd + self.pystate[self.nonpythoncommand] = onecmd try: interp.interact() except SystemExit: |