feat: add --autoreload flag
This commit is contained in:
parent
6db4b6f2e6
commit
09868c26a9
1 changed files with 7 additions and 2 deletions
|
|
@ -486,8 +486,13 @@ frappe.db.connect()
|
|||
|
||||
|
||||
@click.command('console')
|
||||
@click.option(
|
||||
'--autoreload',
|
||||
is_flag=True,
|
||||
help="Reload changes to code automatically"
|
||||
)
|
||||
@pass_context
|
||||
def console(context):
|
||||
def console(context, autoreload=False):
|
||||
"Start ipython console for a site"
|
||||
site = get_site(context)
|
||||
frappe.init(site=site)
|
||||
|
|
@ -497,7 +502,7 @@ def console(context):
|
|||
from IPython.terminal.embed import InteractiveShellEmbed
|
||||
|
||||
terminal = InteractiveShellEmbed()
|
||||
if frappe.conf.developer_mode:
|
||||
if autoreload:
|
||||
terminal.extension_manager.load_extension("autoreload")
|
||||
terminal.run_line_magic("autoreload", "2")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue