configure output file
This commit is contained in:
parent
89508608f0
commit
872abf2e6c
14
main.py
14
main.py
@ -261,7 +261,9 @@ def fetch(replay: str, cache: bool = True) -> Replay:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(
|
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("-v", "--verbose", action="count", help="add debugging info")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -270,6 +272,14 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="fetch replays instead of using cache",
|
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")
|
parser.add_argument("replay", nargs="+", help="replay ID or URL")
|
||||||
|
|
||||||
args = parser.parse_args(sys.argv[1:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
@ -279,7 +289,7 @@ def main():
|
|||||||
LOG.setLevel(logging.DEBUG)
|
LOG.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = sqlite3.connect("data.db")
|
db = sqlite3.connect(args.output)
|
||||||
_init_db(db)
|
_init_db(db)
|
||||||
|
|
||||||
for r in args.replay:
|
for r in args.replay:
|
||||||
|
Loading…
Reference in New Issue
Block a user