From 5225d89210090dc87465e9bd79799cc78475b2b5 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 28 Jul 2023 20:10:10 -0400 Subject: [PATCH] Allow choosing custom path to language JSON Intended for use in dev, to allow pointing at the local 1.16 file as changes are made --- scripts/gen-markdown-patchlist.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/gen-markdown-patchlist.py b/scripts/gen-markdown-patchlist.py index 28b86299..35667b35 100644 --- a/scripts/gen-markdown-patchlist.py +++ b/scripts/gen-markdown-patchlist.py @@ -1,19 +1,24 @@ #!/usr/bin/python3 -import json, os, subprocess, sys +import argparse, json, os, subprocess, sys # to import other scripts in same folder sys.path.append(os.path.dirname(os.path.realpath(__file__))) from contextlib import redirect_stdout from modernfixlib import get_valid_mixin_options +parser = argparse.ArgumentParser(description='Generate ModernFix patch summary Markdown file.') +parser.add_argument('-p', '--langpath', default='common/src/main/resources/assets/modernfix/lang/en_us.json') + +args = parser.parse_args() + branch_name = subprocess.check_output(['git', 'branch', '--show-current']).decode("utf-8").strip() with open('doc/generated/' + branch_name + '-Summary-of-Patches.md', 'w') as output_file: all_current_mixin_options = get_valid_mixin_options() options_missing_descriptions = set() with redirect_stdout(output_file): - with open('common/src/main/resources/assets/modernfix/lang/en_us.json') as lang_json: + with open(args.langpath) as lang_json: lang_obj = json.loads(lang_json.read()) option_names = set() for key, value in lang_obj.items():