diff options
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-x | cmd2/cmd2.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f4f30bd4..63a3cbe3 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2927,9 +2927,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() |