aboutsummaryrefslogtreecommitdiff
path: root/scripts/cli_parser.py
blob: bceb3f41edbc33fa1c057d7ab43c611ecd5da8f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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