diff --git a/update-presets.py b/update-presets.py index fc667f3c6..fd3e13bf6 100644 --- a/update-presets.py +++ b/update-presets.py @@ -3,7 +3,7 @@ Usage: update-presets.py [options] update-presets.py add - update-presets.py list-non-default + update-presets.py list-non-default [--rust] update-presets.py diff update-presets.py (-h | --help) @@ -13,6 +13,7 @@ --from= update presets to match the given git commit --hook run noninteractively for git pre-commit hook purposes --preset= only update the named preset + --rust list non-default settings in Rust syntax appropriate for the midos.house codebase """ import sys @@ -106,7 +107,15 @@ def get_preset(presets, name): if preset is None: preset = json.loads(subprocess.run([sys.executable, 'OoTRandomizer.py', '--convert_settings', '--settings_string', arguments['']], stdout=subprocess.PIPE, encoding='utf-8', check=True).stdout) non_default = {name: value for name, value in preset.items() if value != SETTINGS_DICT[name].default} - print(json.dumps(non_default, indent=4)) + if arguments['--rust']: + print('collect![') + for name, value in non_default.items(): + if name == 'aliases': + continue + print('\n '.join(f' format!("{name}") => json!({json.dumps(value, indent=4)}),'.splitlines())) #TODO trailing commas in arrays/objects + print(']') + else: + print(json.dumps(non_default, indent=4)) elif arguments['diff']: if arguments[''] == 'default': left = {setting_name: setting.default for setting_name, setting in SETTINGS_DICT.items() if setting.shared or setting_name == 'aliases'} diff --git a/version.py b/version.py index 3c2b88436..b2fc3d2f6 100644 --- a/version.py +++ b/version.py @@ -1,7 +1,7 @@ __version__ = '8.1.69' # This is a supplemental version number for branches based off of main dev. -supplementary_version = 1 +supplementary_version = 2 # Pick a unique identifier byte for your fork if you are intending to have a long-lasting branch. # This will be 0x00 for main releases and 0x01 for main dev.