Skip to content

Add support for ptpython config and history files #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions flask_shell_ptpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def shell_command():
without having to manually configure the application.
"""
from flask.globals import _app_ctx_stack
from ptpython.repl import embed
from ptpython.repl import embed, run_config
from ptpython.entry_points.run_ptpython import create_parser, get_config_and_history_file

app = _app_ctx_stack.top.app
ctx = {}
Expand All @@ -34,4 +35,15 @@ def shell_command():

ctx.update(app.make_shell_context())

embed(globals=ctx)
config_file, history_filename = get_config_and_history_file(
create_parser().parse_args([])
)

def configure(repl):
run_config(repl, config_file=config_file)

embed(
globals=ctx,
history_filename=history_filename,
configure=configure
)