diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-19 11:50:52 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-19 11:50:52 +0200 |
commit | 4b74bb0fc3af5daf05a3474a3fa6e02768123c27 (patch) | |
tree | a457316716e47e01e7bbf452977e539220dc0888 | |
parent | Improve documentation. (diff) | |
download | rainbow-parenthesis-4b74bb0fc3af5daf05a3474a3fa6e02768123c27.tar.gz rainbow-parenthesis-4b74bb0fc3af5daf05a3474a3fa6e02768123c27.tar.xz |
Move argparser creation to own procedure.
-rw-r--r-- | rainbow_parenthesis/__main__.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/rainbow_parenthesis/__main__.py b/rainbow_parenthesis/__main__.py index 51473c9..d600806 100644 --- a/rainbow_parenthesis/__main__.py +++ b/rainbow_parenthesis/__main__.py @@ -10,11 +10,22 @@ from . import term import argparse -def main(): - """Interactive entry point for the program.""" +def build_argparse() -> argparse.ArgumentParser: + """ + Construct the argument parser for ``rainbow`` . + + This is mostly a separate procedure to allow direct generation of + man pages. + """ parser = argparse.ArgumentParser(prog='rainbow') parser.add_argument('input', type=argparse.FileType('r'), nargs='?', default='-') + return parser + + +def main(): + """Interactive entry point for the program.""" + parser = build_argparse() args = parser.parse_args() for item in colorize(args.input): |