From 872abf2e6cc49daff5aced136d7631a7225eaeb9 Mon Sep 17 00:00:00 2001 From: xeals Date: Tue, 28 Mar 2023 00:24:21 +1100 Subject: [PATCH] configure output file --- main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index c2ed17d..7b6e98c 100755 --- a/main.py +++ b/main.py @@ -261,7 +261,9 @@ def fetch(replay: str, cache: bool = True) -> Replay: def main(): parser = argparse.ArgumentParser( - prog=APP, description="extracts stats from a Showdown replay" + prog=APP, + description="extracts stats from a Showdown replay", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add_argument("-v", "--verbose", action="count", help="add debugging info") parser.add_argument( @@ -270,6 +272,14 @@ def main(): action="store_true", help="fetch replays instead of using cache", ) + parser.add_argument( + "-o", + "--output", + action="store", + metavar="FILE", + default="data.db", + help="output data file", + ) parser.add_argument("replay", nargs="+", help="replay ID or URL") args = parser.parse_args(sys.argv[1:]) @@ -279,7 +289,7 @@ def main(): LOG.setLevel(logging.DEBUG) try: - db = sqlite3.connect("data.db") + db = sqlite3.connect(args.output) _init_db(db) for r in args.replay: