sphinx-argparse-cli 1.21.2__tar.gz → 1.21.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/PKG-INFO +1 -1
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/__init__.py +14 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/_logic.py +4 -3
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/version.py +2 -2
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/tests/test_logic.py +9 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/.gitignore +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/LICENSE.txt +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/README.md +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/pyproject.toml +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/py.typed +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/tests/complex.txt +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/tests/complex_pre_310.txt +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/tests/conftest.py +0 -0
- {sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/tests/test_sphinx_argparse_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sphinx-argparse-cli
|
|
3
|
-
Version: 1.21.
|
|
3
|
+
Version: 1.21.3
|
|
4
4
|
Summary: render CLI arguments (sub-commands friendly) defined by argparse module
|
|
5
5
|
Project-URL: Documentation, https://github.com/tox-dev/sphinx-argparse-cli#sphinx-argparse-cli
|
|
6
6
|
Project-URL: Homepage, https://github.com/tox-dev/sphinx-argparse-cli
|
{sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/__init__.py
RENAMED
|
@@ -15,10 +15,24 @@ def setup(app: Sphinx) -> dict[str, Any]:
|
|
|
15
15
|
|
|
16
16
|
app.add_directive(SphinxArgparseCli.name, SphinxArgparseCli)
|
|
17
17
|
app.add_config_value("sphinx_argparse_cli_prefix_document", False, "env") # noqa: FBT003
|
|
18
|
+
app.add_css_file("sphinx_argparse_cli.css")
|
|
19
|
+
app.connect("build-finished", _write_css)
|
|
18
20
|
|
|
19
21
|
return {"parallel_read_safe": True}
|
|
20
22
|
|
|
21
23
|
|
|
24
|
+
def _write_css(app: Sphinx, exception: Exception | None) -> None:
|
|
25
|
+
if exception or not app.builder or app.builder.format != "html":
|
|
26
|
+
return
|
|
27
|
+
from pathlib import Path # noqa: PLC0415
|
|
28
|
+
|
|
29
|
+
static = Path(app.outdir) / "_static"
|
|
30
|
+
static.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
(static / "sphinx_argparse_cli.css").write_text(
|
|
32
|
+
".sphinx-argparse-cli-wrap pre { white-space: pre-wrap; word-wrap: break-word; }\n"
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
22
36
|
__all__ = [
|
|
23
37
|
"__version__",
|
|
24
38
|
]
|
|
@@ -145,7 +145,8 @@ class SphinxArgparseCli(SphinxDirective):
|
|
|
145
145
|
self._parser.prog = new_prog
|
|
146
146
|
_update_sub_parser_prog(self._parser, old_prog, new_prog)
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
formatter = self._parser.formatter_class
|
|
149
|
+
self._raw_format = isinstance(formatter, type) and issubclass(formatter, RawDescriptionHelpFormatter)
|
|
149
150
|
return self._parser
|
|
150
151
|
|
|
151
152
|
def _load_sub_parsers(
|
|
@@ -224,7 +225,7 @@ class SphinxArgparseCli(SphinxDirective):
|
|
|
224
225
|
if block is None:
|
|
225
226
|
return None
|
|
226
227
|
if self._raw_format and "\n" in block:
|
|
227
|
-
lit = literal_block("", Text(block))
|
|
228
|
+
lit = literal_block("", Text(block), classes=["sphinx-argparse-cli-wrap"])
|
|
228
229
|
lit["language"] = "none"
|
|
229
230
|
return lit
|
|
230
231
|
return paragraph("", Text(block))
|
|
@@ -424,7 +425,7 @@ class SphinxArgparseCli(SphinxDirective):
|
|
|
424
425
|
with self.no_color():
|
|
425
426
|
texts = parser.format_usage()[len("usage: ") :].splitlines()
|
|
426
427
|
texts = [line if at == 0 else f"{' ' * (len(parser.prog) + 1)}{line.lstrip()}" for at, line in enumerate(texts)]
|
|
427
|
-
return literal_block("", Text("\n".join(texts)))
|
|
428
|
+
return literal_block("", Text("\n".join(texts)), classes=["sphinx-argparse-cli-wrap"])
|
|
428
429
|
|
|
429
430
|
@contextmanager
|
|
430
431
|
def no_color(self) -> Iterator[None]:
|
{sphinx_argparse_cli-1.21.2 → sphinx_argparse_cli-1.21.3}/src/sphinx_argparse_cli/version.py
RENAMED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.21.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 21,
|
|
31
|
+
__version__ = version = '1.21.3'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 21, 3)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
|
@@ -133,6 +133,15 @@ def test_multiline_epilog_as_html(build_outcome: str) -> None:
|
|
|
133
133
|
assert ref in build_outcome
|
|
134
134
|
|
|
135
135
|
|
|
136
|
+
@pytest.mark.sphinx(buildername="html", testroot="epilog-multiline-subclass")
|
|
137
|
+
def test_multiline_epilog_subclass_formatter_as_html(build_outcome: str) -> None:
|
|
138
|
+
ref = (
|
|
139
|
+
"This epilog\nspans multiple lines.\n\n this line is indented.\n and also this.\n\nNow this should be"
|
|
140
|
+
" a separate paragraph.\n"
|
|
141
|
+
)
|
|
142
|
+
assert ref in build_outcome
|
|
143
|
+
|
|
144
|
+
|
|
136
145
|
@pytest.mark.sphinx(buildername="text", testroot="complex")
|
|
137
146
|
@pytest.mark.prepare(directive_args=[":usage_width: 100"])
|
|
138
147
|
def test_usage_width_default(build_outcome: str) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|