Fix commandline interface
This commit is contained in:
parent
25e1542827
commit
d57535415b
1 changed files with 13 additions and 16 deletions
29
src/Main.gd
29
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue