diff options
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 |