|
48 | 48 | else: |
49 | 49 | readline.parse_and_bind('tab: complete') |
50 | 50 |
|
| 51 | +COMMAND_DESCRIPTION = __( |
| 52 | + '\n' |
| 53 | + 'Generate required files for a Sphinx project.\n' |
| 54 | + '\n' |
| 55 | + 'sphinx-quickstart is an interactive tool that asks some questions about your\n' |
| 56 | + 'project and then generates a complete documentation directory and sample\n' |
| 57 | + 'Makefile to be used with sphinx-build.\n', |
| 58 | +) |
| 59 | + |
51 | 60 | EXTENSIONS = { |
52 | 61 | 'autodoc': __('automatically insert docstrings from modules'), |
53 | 62 | 'doctest': __('automatically test code snippets in doctest blocks'), |
@@ -569,20 +578,15 @@ def valid_dir(d: dict[str, Any]) -> bool: |
569 | 578 |
|
570 | 579 |
|
571 | 580 | def get_parser() -> argparse.ArgumentParser: |
572 | | - description = __( |
573 | | - '\n' |
574 | | - 'Generate required files for a Sphinx project.\n' |
575 | | - '\n' |
576 | | - 'sphinx-quickstart is an interactive tool that asks some questions about your\n' |
577 | | - 'project and then generates a complete documentation directory and sample\n' |
578 | | - 'Makefile to be used with sphinx-build.\n', |
579 | | - ) |
580 | 581 | parser = argparse.ArgumentParser( |
581 | 582 | usage='%(prog)s [OPTIONS] <PROJECT_DIR>', |
582 | 583 | epilog=__('For more information, visit <https://www.sphinx-doc.org/>.'), |
583 | | - description=description, |
| 584 | + description=str(COMMAND_DESCRIPTION), # str() for resolving TranslationProxy |
584 | 585 | ) |
| 586 | + return set_up_parser(parser) |
585 | 587 |
|
| 588 | + |
| 589 | +def set_up_parser(parser: argparse.ArgumentParser) -> None: |
586 | 590 | parser.add_argument( |
587 | 591 | '-q', |
588 | 592 | '--quiet', |
@@ -748,6 +752,10 @@ def main(argv: Sequence[str] = (), /) -> int: |
748 | 752 | except SystemExit as err: |
749 | 753 | return err.code # type: ignore[return-value] |
750 | 754 |
|
| 755 | + return run(args) |
| 756 | + |
| 757 | + |
| 758 | +def run(args: Namespace) -> int: |
751 | 759 | d = vars(args) |
752 | 760 | # delete None or False value |
753 | 761 | d = {k: v for k, v in d.items() if v is not None} |
|
0 commit comments