mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Rename --help-config to --help-settings, closes #1431
This commit is contained in:
parent
1db116e20e
commit
d2de17987b
3 changed files with 16 additions and 8 deletions
|
|
@ -51,7 +51,7 @@ class Config(click.ParamType):
|
||||||
name, value = config.split(":", 1)
|
name, value = config.split(":", 1)
|
||||||
if name not in DEFAULT_SETTINGS:
|
if name not in DEFAULT_SETTINGS:
|
||||||
self.fail(
|
self.fail(
|
||||||
f"{name} is not a valid option (--help-config to see all)",
|
f"{name} is not a valid option (--help-settings to see all)",
|
||||||
param,
|
param,
|
||||||
ctx,
|
ctx,
|
||||||
)
|
)
|
||||||
|
|
@ -84,7 +84,7 @@ class Setting(CompositeParamType):
|
||||||
name, value = config
|
name, value = config
|
||||||
if name not in DEFAULT_SETTINGS:
|
if name not in DEFAULT_SETTINGS:
|
||||||
self.fail(
|
self.fail(
|
||||||
f"{name} is not a valid option (--help-config to see all)",
|
f"{name} is not a valid option (--help-settings to see all)",
|
||||||
param,
|
param,
|
||||||
ctx,
|
ctx,
|
||||||
)
|
)
|
||||||
|
|
@ -408,7 +408,7 @@ def uninstall(packages, yes):
|
||||||
help="Run an HTTP GET request against this path, print results and exit",
|
help="Run an HTTP GET request against this path, print results and exit",
|
||||||
)
|
)
|
||||||
@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-settings", is_flag=True, help="Show available settings")
|
||||||
@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(
|
@click.option(
|
||||||
"-o",
|
"-o",
|
||||||
|
|
@ -456,7 +456,7 @@ def serve(
|
||||||
root,
|
root,
|
||||||
get,
|
get,
|
||||||
version_note,
|
version_note,
|
||||||
help_config,
|
help_settings,
|
||||||
pdb,
|
pdb,
|
||||||
open_browser,
|
open_browser,
|
||||||
create,
|
create,
|
||||||
|
|
@ -466,9 +466,9 @@ def serve(
|
||||||
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"""
|
||||||
if help_config:
|
if help_settings:
|
||||||
formatter = formatting.HelpFormatter()
|
formatter = formatting.HelpFormatter()
|
||||||
with formatter.section("Config options"):
|
with formatter.section("Settings"):
|
||||||
formatter.write_dl(
|
formatter.write_dl(
|
||||||
[
|
[
|
||||||
(option.name, f"{option.help} (default={option.default})")
|
(option.name, f"{option.help} (default={option.default})")
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ Options:
|
||||||
--get TEXT Run an HTTP GET request against this path, print results and
|
--get TEXT Run an HTTP GET request against this path, print results and
|
||||||
exit
|
exit
|
||||||
--version-note TEXT Additional note to show on /-/versions
|
--version-note TEXT Additional note to show on /-/versions
|
||||||
--help-config Show available config options
|
--help-settings Show available settings
|
||||||
--pdb Launch debugger on any errors
|
--pdb Launch debugger on any errors
|
||||||
-o, --open Open Datasette in your web browser
|
-o, --open Open Datasette in your web browser
|
||||||
--create Create database files if they do not exist
|
--create Create database files if they do not exist
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from .fixtures import (
|
||||||
EXPECTED_PLUGINS,
|
EXPECTED_PLUGINS,
|
||||||
)
|
)
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from datasette.app import SETTINGS
|
||||||
from datasette.plugins import DEFAULT_PLUGINS
|
from datasette.plugins import DEFAULT_PLUGINS
|
||||||
from datasette.cli import cli, serve
|
from datasette.cli import cli, serve
|
||||||
from datasette.version import __version__
|
from datasette.version import __version__
|
||||||
|
|
@ -147,7 +148,7 @@ def test_metadata_yaml():
|
||||||
root=False,
|
root=False,
|
||||||
version_note=None,
|
version_note=None,
|
||||||
get=None,
|
get=None,
|
||||||
help_config=False,
|
help_settings=False,
|
||||||
pdb=False,
|
pdb=False,
|
||||||
crossdb=False,
|
crossdb=False,
|
||||||
open_browser=False,
|
open_browser=False,
|
||||||
|
|
@ -291,3 +292,10 @@ def test_weird_database_names(ensure_eventloop, tmpdir, filename):
|
||||||
cli, [db_path, "--get", "/{}".format(urllib.parse.quote(filename_no_stem))]
|
cli, [db_path, "--get", "/{}".format(urllib.parse.quote(filename_no_stem))]
|
||||||
)
|
)
|
||||||
assert result2.exit_code == 0, result2.output
|
assert result2.exit_code == 0, result2.output
|
||||||
|
|
||||||
|
|
||||||
|
def test_help_settings():
|
||||||
|
runner = CliRunner()
|
||||||
|
result = runner.invoke(cli, ["--help-settings"])
|
||||||
|
for setting in SETTINGS:
|
||||||
|
assert setting.name in result.output
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue