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)
|
get_tree().quit(1)
|
||||||
return
|
return
|
||||||
var kwargs: Dictionary = parse_custom_cmdline(args)
|
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()
|
show_help()
|
||||||
get_tree().quit(1)
|
get_tree().quit(1)
|
||||||
return
|
return
|
||||||
var batch_mode = false
|
var batch_mode = false
|
||||||
var load_image_dir: DirAccess
|
var load_image_dir: DirAccess
|
||||||
if kwargs["--input"] != null:
|
load_image_dir = DirAccess.open(kwargs["--input"])
|
||||||
load_image_dir = DirAccess.open(kwargs["--input"])
|
if load_image_dir != null:
|
||||||
if load_image_dir != null:
|
# batch mode
|
||||||
# batch mode
|
if DirAccess.open(kwargs["--output"]) == null:
|
||||||
if DirAccess.open(kwargs["--output"]) == null:
|
printerr("If --input is a directory, --output has to be one too.\n")
|
||||||
printerr("If --input is a directory, --output has to be one too.\n")
|
show_help()
|
||||||
show_help()
|
get_tree().quit(1)
|
||||||
get_tree().quit(1)
|
return
|
||||||
return
|
else:
|
||||||
else:
|
batch_mode = true
|
||||||
batch_mode = true
|
|
||||||
#
|
#
|
||||||
Filesystem.shader_path = kwargs["--shader"]
|
Filesystem.shader_path = kwargs["--shader"]
|
||||||
#
|
#
|
||||||
|
@ -93,10 +92,8 @@ func cli(args: PackedStringArray):
|
||||||
get_tree().quit(0)
|
get_tree().quit(0)
|
||||||
else:
|
else:
|
||||||
var errors = []
|
var errors = []
|
||||||
if kwargs["--input"] == null:
|
Filesystem.input_image_path = kwargs["--input"]
|
||||||
errors = await $Compositor.update()
|
errors = await $Compositor.update()
|
||||||
else:
|
|
||||||
errors = await $Compositor.update(kwargs["--input"])
|
|
||||||
if cli_handle_errors(errors) == 0:
|
if cli_handle_errors(errors) == 0:
|
||||||
Filesystem.save_result(kwargs["--output"])
|
Filesystem.save_result(kwargs["--output"])
|
||||||
get_tree().quit(0)
|
get_tree().quit(0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue