blob: 1a4e04969537ba9d9d1b42936dbc2e71d6ff6268 [file] [log] [blame]
Patrick Williamsdf917f82022-01-06 14:20:58 -06001#!/usr/bin/python3
2
3import argparse
4from importlib import import_module
5from typing import List
6
Patrick Williamsd0269de2022-01-06 21:04:25 -06007subcommands = [
8 "analyze-commits",
9 "analyze-reviews",
10 "dump-gerrit",
Patrick Williams4ea34132022-01-07 06:05:13 -060011 "report",
Patrick Williamsd0269de2022-01-06 21:04:25 -060012]
Patrick Williamsdf917f82022-01-06 14:20:58 -060013
14
15def main() -> int:
16 parser = argparse.ArgumentParser(description="Obtain TOF voter metrics")
17 parser.add_argument(
18 "--data-directory",
19 "-d",
20 help="Data directory (default 'data')",
21 dest="dir",
22 default="data",
23 )
24
25 subparser = parser.add_subparsers(help="Available subcommands")
26
27 commands = []
28 for c in subcommands:
29 commands.append(
30 import_module("libvoters.subcmd." + c).subcmd(subparser) # type: ignore
31 )
32
33 args = parser.parse_args()
34
35 if "cmd" not in args:
36 print("Missing subcommand!")
37 return 1
38
39 return int(args.cmd.run(args))