blob: 78d963fb0824db168e088141374109f5a8dc93e2 [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",
11]
Patrick Williamsdf917f82022-01-06 14:20:58 -060012
13
14def main() -> int:
15 parser = argparse.ArgumentParser(description="Obtain TOF voter metrics")
16 parser.add_argument(
17 "--data-directory",
18 "-d",
19 help="Data directory (default 'data')",
20 dest="dir",
21 default="data",
22 )
23
24 subparser = parser.add_subparsers(help="Available subcommands")
25
26 commands = []
27 for c in subcommands:
28 commands.append(
29 import_module("libvoters.subcmd." + c).subcmd(subparser) # type: ignore
30 )
31
32 args = parser.parse_args()
33
34 if "cmd" not in args:
35 print("Missing subcommand!")
36 return 1
37
38 return int(args.cmd.run(args))