print the arguments to be executed

This commit is contained in:
Ren Tatsumoto 2024-02-29 02:24:23 +03:00
parent 305dbd2fdf
commit 498a4d0975
2 changed files with 14 additions and 0 deletions

View file

@ -150,6 +150,8 @@ this.create_clip = function(clip_type, on_complete)
end end
end)() end)()
print("The following args will be executed:", table.concat(h.quote_if_necessary(args), " ") )
local output_dir_path = utils.split_path(output_file_path) local output_dir_path = utils.split_path(output_file_path)
local location_info = utils.file_info(output_dir_path) local location_info = utils.file_info(output_dir_path)
if not location_info.is_dir then if not location_info.is_dir then

View file

@ -83,4 +83,16 @@ this.human_readable_time = function(seconds)
return ret return ret
end end
this.quote_if_necessary = function(args)
local ret = {}
for _, v in ipairs(args) do
if v:find(" ") then
table.insert(ret, (v:find("'") and string.format('"%s"', v) or string.format("'%s'", v)))
else
table.insert(ret, v)
end
end
return ret
end
return this return this