From 32c18e4e093bc68fbce938dc17ecec8f39c35f9d Mon Sep 17 00:00:00 2001 From: Zach H Date: Sat, 24 Jun 2023 16:55:47 -0400 Subject: [PATCH] Support --sets to build only specific sets (#91) - Fix #76 --- mtgsqlive/__main__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mtgsqlive/__main__.py b/mtgsqlive/__main__.py index 47a8178..9e86769 100644 --- a/mtgsqlive/__main__.py +++ b/mtgsqlive/__main__.py @@ -69,6 +69,13 @@ def parse_args() -> argparse.Namespace: default="/tmp/mtgsqlive", help="Where to place translated files", ) + parser.add_argument( + "-s", + "--sets", + type=str.upper, + nargs="*", + help="Transpose specific sets instead of all sets", + ) converter_group = parser.add_argument_group(title="Converters") converter_group.add_argument( @@ -114,6 +121,11 @@ def main() -> None: with mtgjson_input_file.open(encoding="utf-8") as fp: mtgjson_input_data = json.load(fp) + if args.sets: + for set_key in list(mtgjson_input_data["data"].keys()): + if set_key not in args.sets: + del mtgjson_input_data["data"][set_key] + for converter in converters_map.values(): LOGGER.info(f"Converting {data_type.value} via {converter.__name__}") converter(mtgjson_input_data, args.output_dir, data_type).convert()