Skip to content

Commit

Permalink
Support --sets to build only specific sets (#91)
Browse files Browse the repository at this point in the history
- Fix #76
  • Loading branch information
ZeldaZach authored Jun 24, 2023
1 parent 2649a56 commit 32c18e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mtgsqlive/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 32c18e4

Please sign in to comment.