diff options
author | anselor <anselor@gmail.com> | 2018-05-19 12:13:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-19 12:13:08 -0400 |
commit | a38e3f26887f60a358a5e36421a52526a04637f5 (patch) | |
tree | f25af604947e3f533bb10f8fe0d892779a775166 /cmd2/cmd2.py | |
parent | 8125d45412cce07b1316ef19fdcbc98deeb0a57a (diff) | |
parent | 4699451df8d0b0ff87b2332ab26498e372309ec4 (diff) | |
download | cmd2-git-a38e3f26887f60a358a5e36421a52526a04637f5.tar.gz |
Merge pull request #405 from python-cmd2/pyscript
Pyscript updates
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 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() |