Allow different output name for generate_opcodes_file.py

This commit is contained in:
Flawed
2024-07-06 09:50:12 -07:00
parent 3be38b0faa
commit 7a34159bc6
+7 -1
View File
@@ -56,8 +56,11 @@ def replace_line_with_new_opcode(line, diff, ver, old_ver):
@click.option(
"--reverse", is_flag=True, help="Applies the diff file in the opposite direction"
)
@click.option(
"-o", "--output", type=click.Path(exists = False, resolve_path=True), help="Output filename"
)
def generate_opcodes_file(
old_version_string, new_version_string, diff_file, opcodes_file, reverse
old_version_string, new_version_string, diff_file, opcodes_file, reverse, output
):
"""
Parses an OPCODES_FILE and applies a JSON DIFF_FILE to generate a new one.
@@ -81,6 +84,9 @@ def generate_opcodes_file(
)
)
if output:
new_filename = output
else:
new_filename = f"Ipcs.{new_version_string}.h"
with open(new_filename, "w+") as f:
f.writelines(queued_lines)