diff options
author | Frederick Muriuki Muriithi | 2024-01-15 06:07:05 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-15 06:07:05 +0300 |
commit | 8fe991c20f27702ee34ffcdd0cbc96e411db8c90 (patch) | |
tree | 509c0d1a00bf96bc3308802765e5ae63cfeb123c /scripts/cli_parser.py | |
parent | f89c08c392182b669d058a4c21feffde64b15ebb (diff) | |
download | gn-uploader-8fe991c20f27702ee34ffcdd0cbc96e411db8c90.tar.gz |
Extract common structure into separate modules.
Diffstat (limited to 'scripts/cli_parser.py')
-rw-r--r-- | scripts/cli_parser.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/cli_parser.py b/scripts/cli_parser.py new file mode 100644 index 0000000..bceb3f4 --- /dev/null +++ b/scripts/cli_parser.py @@ -0,0 +1,26 @@ +"""Common utilities for CLI parsers""" +from uuid import UUID +from typing import Optional +from argparse import ArgumentParser + +def init_cli_parser(program: str, description: Optional[str] = None) -> ArgumentParser: + """Initialise the CLI arguments parser.""" + parser = ArgumentParser(prog=program, description=description) + + parser.add_argument("databaseuri", help="URL to MariaDB") + parser.add_argument("redisuri", help="URL to Redis") + parser.add_argument("jobid", + help="Job ID that this belongs to.", + type=UUID) + parser.add_argument("--redisexpiry", + help="How long to keep any redis keys around.", + type=int, + default=86400) + + parser.add_argument("speciesid", + type=int, + help="Species to which bundle relates.") + parser.add_argument("populationid", + type=int, + help="Population to group data under") + return parser |