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
e837095ef3
commit
77f46297a8
3 changed files with 16 additions and 8 deletions
|
|
@ -51,7 +51,7 @@ class Config(click.ParamType):
|
|||
name, value = config.split(":", 1)
|
||||
if name not in DEFAULT_SETTINGS:
|
||||
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,
|
||||
ctx,
|
||||
)
|
||||
|
|
@ -84,7 +84,7 @@ class Setting(CompositeParamType):
|
|||
name, value = config
|
||||
if name not in DEFAULT_SETTINGS:
|
||||
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,
|
||||
ctx,
|
||||
)
|
||||
|
|
@ -408,7 +408,7 @@ def uninstall(packages, yes):
|
|||
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("--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(
|
||||
"-o",
|
||||
|
|
@ -456,7 +456,7 @@ def serve(
|
|||
root,
|
||||
get,
|
||||
version_note,
|
||||
help_config,
|
||||
help_settings,
|
||||
pdb,
|
||||
open_browser,
|
||||
create,
|
||||
|
|
@ -466,9 +466,9 @@ def serve(
|
|||
return_instance=False,
|
||||
):
|
||||
"""Serve up specified SQLite database files with a web UI"""
|
||||
if help_config:
|
||||
if help_settings:
|
||||
formatter = formatting.HelpFormatter()
|
||||
with formatter.section("Config options"):
|
||||
with formatter.section("Settings"):
|
||||
formatter.write_dl(
|
||||
[
|
||||
(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
|
||||
exit
|
||||
--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
|
||||
-o, --open Open Datasette in your web browser
|
||||
--create Create database files if they do not exist
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from .fixtures import (
|
|||
EXPECTED_PLUGINS,
|
||||
)
|
||||
import asyncio
|
||||
from datasette.app import SETTINGS
|
||||
from datasette.plugins import DEFAULT_PLUGINS
|
||||
from datasette.cli import cli, serve
|
||||
from datasette.version import __version__
|
||||
|
|
@ -147,7 +148,7 @@ def test_metadata_yaml():
|
|||
root=False,
|
||||
version_note=None,
|
||||
get=None,
|
||||
help_config=False,
|
||||
help_settings=False,
|
||||
pdb=False,
|
||||
crossdb=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))]
|
||||
)
|
||||
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