forked from simonw/datasette
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate-docs-help.py
More file actions
25 lines (19 loc) · 783 Bytes
/
update-docs-help.py
File metadata and controls
25 lines (19 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from click.testing import CliRunner
from datasette.cli import cli
from pathlib import Path
docs_path = Path(__file__).parent / "docs"
includes = (
("serve", "datasette-serve-help.txt"),
("package", "datasette-package-help.txt"),
("publish heroku", "datasette-publish-heroku-help.txt"),
("publish cloudrun", "datasette-publish-cloudrun-help.txt"),
)
def update_help_includes():
for name, filename in includes:
runner = CliRunner()
result = runner.invoke(cli, name.split() + ["--help"], terminal_width=88)
actual = f"$ datasette {name} --help\n\n{result.output}"
actual = actual.replace("Usage: cli ", "Usage: datasette ")
(docs_path / filename).write_text(actual)
if __name__ == "__main__":
update_help_includes()