Skip to content
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
)