Skip to content

Commit

Permalink
Rename --help-config to --help-settings, closes #1431
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Aug 13, 2021
1 parent e837095 commit 77f4629
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
12 changes: 6 additions & 6 deletions datasette/cli.py
Expand Up @@ -51,7 +51,7 @@ def convert(self, config, param, ctx):
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,
)
Expand Down Expand Up @@ -84,7 +84,7 @@ def convert(self, config, param, ctx):
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,
)
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -456,7 +456,7 @@ def serve(
root,
get,
version_note,
help_config,
help_settings,
pdb,
open_browser,
create,
Expand All @@ -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})")
Expand Down
2 changes: 1 addition & 1 deletion docs/datasette-serve-help.txt
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion tests/test_cli.py
Expand Up @@ -5,6 +5,7 @@
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__
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit 77f4629

Please sign in to comment.