blob: a6cc1eabc074b3daf79a8fbde02e853ff07b1243 [file] [log] [blame]
Patrick Williamsdf917f82022-01-06 14:20:58 -06001#!/usr/bin/python3
2
3import argparse
4from importlib import import_module
Patrick Williamsa3db66b2022-12-04 16:27:08 -06005
Patrick Williamsdf917f82022-01-06 14:20:58 -06006
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 ]
Patrick Williamsa3db66b2022-12-04 16:27:08 -060025 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))