rename --target to --input

This commit is contained in:
matthias@arch 2023-09-29 14:36:55 +02:00
parent 4cbbd2961e
commit a10bbc005e

View File

@ -521,9 +521,9 @@ def missing_arg(arg):
def help(): def help():
helpstring = """Synopsis: helpstring = """Synopsis:
Inject <inject-file> into <target-file>: Inject <inject-file> into <target-file>:
python3 html-inect.py --target <target-file> --output <output-file> [OPTIONS] python3 html-inect.py --input <input-file> --output <output-file> [OPTIONS]
\nCommand line options: \nCommand line options:
--target <file> path to the target file --input <file> path to the input file
--output <file> output to this file instead of overwriting target --output <file> output to this file instead of overwriting target
--inplace edit target file in place --inplace edit target file in place
--var <varname>=<value> set the value of a variable. Can be used multiple times --var <varname>=<value> set the value of a variable. Can be used multiple times
@ -543,7 +543,7 @@ if __name__ == "__main__":
inplace = False inplace = False
i = 1 i = 1
while i in range(1, len(argv)): while i in range(1, len(argv)):
if argv[i] == "--target": if argv[i] == "--input":
if len(argv) > i + 1: target_path = argv[i+1].strip(" ") if len(argv) > i + 1: target_path = argv[i+1].strip(" ")
else: missing_arg_val(argv[i]) else: missing_arg_val(argv[i])
i += 1 i += 1
@ -578,7 +578,7 @@ if __name__ == "__main__":
error(f"Invalid argument: {argv[i]}") error(f"Invalid argument: {argv[i]}")
i += 1 i += 1
# sanity checks # sanity checks
if not target_path: missing_arg("--target") if not target_path: missing_arg("--input")
if not os.path.isfile(target_path): error(f"Invalid target: {target_path} (does not exist)") if not os.path.isfile(target_path): error(f"Invalid target: {target_path} (does not exist)")
if inplace: output_path = target_path if inplace: output_path = target_path
if not output_path: if not output_path: