summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcatherine <catherine@dellzilla>2009-03-24 13:59:00 -0400
committercatherine <catherine@dellzilla>2009-03-24 13:59:00 -0400
commitb9f5b3f28222f03acb7816c0cac55eab321090d5 (patch)
tree9169b985a8988aab2e050686d7eaa8aaa78e4ddd
parent773deb9e970ac6910bfad0e794914cd5c491a230 (diff)
downloadcmd2-hg-b9f5b3f28222f03acb7816c0cac55eab321090d5.tar.gz
py really working right now
-rwxr-xr-xcmd2.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd2.py b/cmd2.py
index 753c117..7b6842f 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -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: