blob: 1dd50c3eb4dd1b02d251e23e459d56dc0040badd [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 Williamsdf917f82022-01-06 14:20:58 -06007def main() -> int:
8 parser = argparse.ArgumentParser(description="Obtain TOF voter metrics")
9 parser.add_argument(
10 "--data-directory",
11 "-d",
12 help="Data directory (default 'data')",
13 dest="dir",
14 default="data",
15 )
16
17 subparser = parser.add_subparsers(help="Available subcommands")
18
Patrick Williams22b77422022-01-19 16:33:42 -060019 commands = [
20 import_module("libvoters.subcmd.analyze-commits"),
21 import_module("libvoters.subcmd.analyze-reviews"),
22 import_module("libvoters.subcmd.dump-gerrit"),
23 import_module("libvoters.subcmd.report"),
24 ]
25 commands = [x.subcmd(subparser) for x in commands] # type: ignore
Patrick Williamsdf917f82022-01-06 14:20:58 -060026
27 args = parser.parse_args()
28
29 if "cmd" not in args:
30 print("Missing subcommand!")
31 return 1
32
33 return int(args.cmd.run(args))