tof-voters: begin tool for voter membership
The TOF voting requires looking at Gerrit data to determine who is
eligible to vote. Start a tool that can be used to dump and analyze
this data.
First sub-command added is a method to dump all Gerrit data after a
certain date (typically the cut-off for the previous election).
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I02b22c9dcb81b570ac3872d7c38f838d61690c83
diff --git a/tof-voters/libvoters/entry_point.py b/tof-voters/libvoters/entry_point.py
new file mode 100644
index 0000000..e36d06e
--- /dev/null
+++ b/tof-voters/libvoters/entry_point.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python3
+
+import argparse
+from importlib import import_module
+from typing import List
+
+subcommands = ["dump-gerrit"]
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description="Obtain TOF voter metrics")
+ parser.add_argument(
+ "--data-directory",
+ "-d",
+ help="Data directory (default 'data')",
+ dest="dir",
+ default="data",
+ )
+
+ subparser = parser.add_subparsers(help="Available subcommands")
+
+ commands = []
+ for c in subcommands:
+ commands.append(
+ import_module("libvoters.subcmd." + c).subcmd(subparser) # type: ignore
+ )
+
+ args = parser.parse_args()
+
+ if "cmd" not in args:
+ print("Missing subcommand!")
+ return 1
+
+ return int(args.cmd.run(args))