summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-05-19 12:13:59 -0400
committerEric Lin <anselor@gmail.com>2018-05-19 12:13:59 -0400
commitf44871b5d055651bb4991580b64b18b87568fd7a (patch)
treec27c4b0b78f711a3e0349ae07ed13c7e3bb79dab /cmd2/cmd2.py
parent6652557779faa0cdc4aac781e62f2b4f3b44b836 (diff)
parenta38e3f26887f60a358a5e36421a52526a04637f5 (diff)
downloadcmd2-git-f44871b5d055651bb4991580b64b18b87568fd7a.tar.gz
Merge remote-tracking branch 'origin/master' into autocompleter
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-xcmd2/cmd2.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 9cbbd639..a2d67def 100755
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2630,9 +2630,21 @@ Paths or arguments that contain spaces must be enclosed in quotes
Run python code from external files with ``run filename.py``
End with ``Ctrl-D`` (Unix) / ``Ctrl-Z`` (Windows), ``quit()``, '`exit()``.
"""
- banner = 'Entering an embedded IPython shell type quit() or <Ctrl>-d to exit ...'
- exit_msg = 'Leaving IPython, back to {}'.format(sys.argv[0])
- embed(banner1=banner, exit_msg=exit_msg)
+ from .pyscript_bridge import PyscriptBridge
+ bridge = PyscriptBridge(self)
+
+ if self.locals_in_py:
+ def load_ipy(self, app):
+ banner = 'Entering an embedded IPython shell type quit() or <Ctrl>-d to exit ...'
+ exit_msg = 'Leaving IPython, back to {}'.format(sys.argv[0])
+ embed(banner1=banner, exit_msg=exit_msg)
+ load_ipy(self, bridge)
+ else:
+ def load_ipy(app):
+ banner = 'Entering an embedded IPython shell type quit() or <Ctrl>-d to exit ...'
+ exit_msg = 'Leaving IPython, back to {}'.format(sys.argv[0])
+ embed(banner1=banner, exit_msg=exit_msg)
+ load_ipy(bridge)
history_parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
history_parser_group = history_parser.add_mutually_exclusive_group()