Allow different output name for generate_opcodes_file.py
This commit is contained in:
@@ -56,8 +56,11 @@ def replace_line_with_new_opcode(line, diff, ver, old_ver):
|
|||||||
@click.option(
|
@click.option(
|
||||||
"--reverse", is_flag=True, help="Applies the diff file in the opposite direction"
|
"--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(
|
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.
|
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"
|
new_filename = f"Ipcs.{new_version_string}.h"
|
||||||
with open(new_filename, "w+") as f:
|
with open(new_filename, "w+") as f:
|
||||||
f.writelines(queued_lines)
|
f.writelines(queued_lines)
|
||||||
|
|||||||
Reference in New Issue
Block a user