Fix commandline interface

This commit is contained in:
ChaoticByte 2025-10-10 22:45:55 +02:00
parent 25e1542827
commit d57535415b
Signed by: ChaoticByte
SSH key fingerprint: SHA256:bHr1NPU+JZFLUbsTl2/mfa6U+6dcM7VjKohzXnshfFY

View file

@ -51,23 +51,22 @@ func cli(args: PackedStringArray):
get_tree().quit(1)
return
var kwargs: Dictionary = parse_custom_cmdline(args)
if kwargs["--shader"] == null or kwargs["--output"] == null:
if kwargs["--shader"] == null or kwargs["--output"] == null or kwargs["--input"] == null:
show_help()
get_tree().quit(1)
return
var batch_mode = false
var load_image_dir: DirAccess
if kwargs["--input"] != null:
load_image_dir = DirAccess.open(kwargs["--input"])
if load_image_dir != null:
# batch mode
if DirAccess.open(kwargs["--output"]) == null:
printerr("If --input is a directory, --output has to be one too.\n")
show_help()
get_tree().quit(1)
return
else:
batch_mode = true
load_image_dir = DirAccess.open(kwargs["--input"])
if load_image_dir != null:
# batch mode
if DirAccess.open(kwargs["--output"]) == null:
printerr("If --input is a directory, --output has to be one too.\n")
show_help()
get_tree().quit(1)
return
else:
batch_mode = true
#
Filesystem.shader_path = kwargs["--shader"]
#
@ -93,10 +92,8 @@ func cli(args: PackedStringArray):
get_tree().quit(0)
else:
var errors = []
if kwargs["--input"] == null:
errors = await $Compositor.update()
else:
errors = await $Compositor.update(kwargs["--input"])
Filesystem.input_image_path = kwargs["--input"]
errors = await $Compositor.update()
if cli_handle_errors(errors) == 0:
Filesystem.save_result(kwargs["--output"])
get_tree().quit(0)