diff options
author | Stephen Finucane <stephen@that.guru> | 2017-09-28 19:23:25 +0100 |
---|---|---|
committer | Stephen Finucane <stephen@that.guru> | 2017-10-09 16:28:39 +0100 |
commit | c68381bd6597f50e085b96d7f69a982db8baabda (patch) | |
tree | be78222793f0f7cbcc0f9a087e5f954e3f6145ef /sphinx/cmd/quickstart.py | |
parent | bca566244ab65e26b854818efa5e9f2d509b58c9 (diff) | |
download | sphinx-git-c68381bd6597f50e085b96d7f69a982db8baabda.tar.gz |
sphinx-quickstart: Move parser to a separate function
For the same reasons as the 'sphinx-apidoc' and 'sphinx-autogen' moves.
As before, we also take the opportunity to add a help string.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Diffstat (limited to 'sphinx/cmd/quickstart.py')
-rw-r--r-- | sphinx/cmd/quickstart.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index 5bd0faa39..a616b263e 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -539,14 +539,18 @@ def valid_dir(d): return True -def main(argv=sys.argv[1:]): - # type: (List[str]) -> int - if not color_terminal(): - nocolor() - +def get_parser(): + # type: () -> argparse.ArgumentParser parser = argparse.ArgumentParser( usage='%(prog)s [OPTIONS] <PROJECT_DIR>', - epilog='For more information, visit <http://sphinx-doc.org/>.') + epilog="For more information, visit <http://sphinx-doc.org/>.", + description=""" +Generate required files for a Sphinx project. + +sphinx-quickstart is an interactive tool that asks some questions about your +project and then generates a complete documentation directory and sample +Makefile to be used with sphinx-build. +""") parser.add_argument('-q', '--quiet', action='store_true', dest='quiet', default=False, @@ -614,7 +618,16 @@ def main(argv=sys.argv[1:]): dest='variables', help='define a template variable') + return parser + + +def main(argv=sys.argv[1:]): + # type: (List[str]) -> int + if not color_terminal(): + nocolor() + # parse options + parser = get_parser() try: args = parser.parse_args(argv) except SystemExit as err: |