Skip to content
Snippets Groups Projects
Commit e8b15c82 authored by Antoine Lambert's avatar Antoine Lambert Committed by Antoine Lambert
Browse files

cli: Prevent YAML wrapping in help displayed by Click

The default behavior of Click is to rewrap text based on the width of
the terminal but as a consequence it makes the sample YAML config for
the scrubber displayed in command help quite unreadable as indentation
is lost.

So use \b markers in docstring to ensure proper display of the YAML
config by Click.
parent f406942a
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,17 @@ from swh.core.cli import swh as swh_cli_group
from swh.model.swhids import ObjectType
def _fix_sphinx_docstring():
"""Remove \b markers used by click to prevent text rewrapping in docstring."""
def decorator(f):
if "SWH_DOC_BUILD" in os.environ:
f.__doc__ = f.__doc__.replace("\b", "")
return f
return decorator
@swh_cli_group.group(name="scrubber", context_settings=CONTEXT_SETTINGS)
@click.option(
"--config-file",
......@@ -26,15 +37,17 @@ from swh.model.swhids import ObjectType
help="Configuration file.",
)
@click.pass_context
@_fix_sphinx_docstring()
def scrubber_cli_group(ctx, config_file: Optional[str]) -> None:
"""main command group of the datastore scrubber
\b
Expected config format::
\b
scrubber:
cls: postgresql
db: "service=..." # libpq DSN
\b
# for storage checkers + origin locator only:
storage:
cls: postgresql # cannot be remote for checkers, as they need direct
......@@ -42,7 +55,7 @@ def scrubber_cli_group(ctx, config_file: Optional[str]) -> None:
db": "service=..." # libpq DSN
objstorage:
cls: memory
\b
# for journal checkers only:
journal:
# see https://docs.softwareheritage.org/devel/apidoc/swh.journal.client.html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment