kopia lustrzana https://github.com/simonw/datasette
Fix for 'open' bug, closes #973
rodzic
a980199e61
commit
cac051bb8a
|
@ -354,7 +354,13 @@ def uninstall(packages, yes):
|
||||||
@click.option("--version-note", help="Additional note to show on /-/versions")
|
@click.option("--version-note", help="Additional note to show on /-/versions")
|
||||||
@click.option("--help-config", is_flag=True, help="Show available config options")
|
@click.option("--help-config", is_flag=True, help="Show available config options")
|
||||||
@click.option("--pdb", is_flag=True, help="Launch debugger on any errors")
|
@click.option("--pdb", is_flag=True, help="Launch debugger on any errors")
|
||||||
@click.option("-o", "--open", is_flag=True, help="Open Datasette in your web browser")
|
@click.option(
|
||||||
|
"-o",
|
||||||
|
"--open",
|
||||||
|
"open_browser",
|
||||||
|
is_flag=True,
|
||||||
|
help="Open Datasette in your web browser",
|
||||||
|
)
|
||||||
def serve(
|
def serve(
|
||||||
files,
|
files,
|
||||||
immutable,
|
immutable,
|
||||||
|
@ -377,7 +383,7 @@ def serve(
|
||||||
version_note,
|
version_note,
|
||||||
help_config,
|
help_config,
|
||||||
pdb,
|
pdb,
|
||||||
open,
|
open_browser,
|
||||||
return_instance=False,
|
return_instance=False,
|
||||||
):
|
):
|
||||||
"""Serve up specified SQLite database files with a web UI"""
|
"""Serve up specified SQLite database files with a web UI"""
|
||||||
|
@ -457,7 +463,7 @@ def serve(
|
||||||
print(url)
|
print(url)
|
||||||
else:
|
else:
|
||||||
url = "http://{}:{}/".format(host, port)
|
url = "http://{}:{}/".format(host, port)
|
||||||
if open:
|
if open_browser:
|
||||||
webbrowser.open(url)
|
webbrowser.open(url)
|
||||||
uvicorn.run(ds.app(), host=host, port=port, log_level="info", lifespan="on")
|
uvicorn.run(ds.app(), host=host, port=port, log_level="info", lifespan="on")
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ def test_metadata_yaml():
|
||||||
get=None,
|
get=None,
|
||||||
help_config=False,
|
help_config=False,
|
||||||
pdb=False,
|
pdb=False,
|
||||||
open=False,
|
open_browser=False,
|
||||||
return_instance=True,
|
return_instance=True,
|
||||||
)
|
)
|
||||||
client = _TestClient(ds.app())
|
client = _TestClient(ds.app())
|
||||||
|
|
Ładowanie…
Reference in New Issue