From d57535415b4c70b819cbee6fb5a63f2a2b1dcfdb Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Fri, 10 Oct 2025 22:45:55 +0200 Subject: [PATCH] Fix commandline interface --- src/Main.gd | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/Main.gd b/src/Main.gd index 134ecaa..0e2cff0 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -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)