1#!/usr/bin/python3 2 3import argparse 4from importlib import import_module 5from typing import List 6 7def 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 19 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 26 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)) 34