From 3cf299429780f0a3a1acae1d4ce62d930c8a60d0 Mon Sep 17 00:00:00 2001 From: LDericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 24 Aug 2021 17:32:51 +0200 Subject: [PATCH] multi deck import --- main.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 81ba907..7e1a74f 100755 --- a/main.py +++ b/main.py @@ -29,13 +29,17 @@ def opus_decks(args: argparse.Namespace) -> list[fftcg.TTSDeck]: return decks -def ffdecks_deck(args: argparse.Namespace) -> list[fftcg.TTSDeck]: +def ffdecks_decks(args: argparse.Namespace) -> list[fftcg.TTSDeck]: # load the current carddb carddb = fftcg.CardDB.get() carddb.load() + decks: list[fftcg.TTSDeck] = [] + for deck_id in args.deck_ids: + decks.append(fftcg.TTSDeck.from_ffdecks_deck(deck_id)) + # import a deck - return [fftcg.TTSDeck.from_ffdecks_deck(args.deck_id)] + return decks def main() -> None: @@ -101,14 +105,15 @@ def main() -> None: ) deck_parser.set_defaults( - func=ffdecks_deck + func=ffdecks_decks ) deck_parser.add_argument( - "deck_id", + "deck_ids", type=str, + nargs="+", metavar="Deck_ID", - help="the Deck to import", + help="the Decks to import", ) # parse arguments