Generate the screenshot for help message on each cli command and save them as svg files.
()
| 9 | |
| 10 | |
| 11 | def gen_cli_help_screenshots() -> None: |
| 12 | """Generate the screenshot for help message on each cli command and save them as svg files.""" |
| 13 | images_root = Path(__file__).parent.parent / "docs" / "images" / "cli_help" |
| 14 | images_root.mkdir(parents=True, exist_ok=True) |
| 15 | |
| 16 | cz_commands = ( |
| 17 | command["name"] if isinstance(command["name"], str) else command["name"][0] |
| 18 | for command in data["subcommands"]["commands"] # type: ignore[index] |
| 19 | ) |
| 20 | for cmd in chain( |
| 21 | ["cz --help"], (f"cz {cz_command} --help" for cz_command in cz_commands) |
| 22 | ): |
| 23 | file_name = f"{cmd.replace(' ', '_').replace('-', '_')}.svg" |
| 24 | _export_cmd_as_svg(cmd, images_root / file_name) |
| 25 | |
| 26 | |
| 27 | def _export_cmd_as_svg(cmd: str, file_path: Path) -> None: |
no test coverage detected