From 7a34159bc645c25a310f36889f65d509257c8bd7 Mon Sep 17 00:00:00 2001 From: Flawed <33593723+ff14wed@users.noreply.github.com> Date: Sat, 6 Jul 2024 09:50:12 -0700 Subject: [PATCH] Allow different output name for generate_opcodes_file.py --- generate_opcodes_file.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generate_opcodes_file.py b/generate_opcodes_file.py index 6d92836..339a36d 100644 --- a/generate_opcodes_file.py +++ b/generate_opcodes_file.py @@ -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,7 +84,10 @@ def generate_opcodes_file( ) ) - new_filename = f"Ipcs.{new_version_string}.h" + 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)