diff --git a/encoder.lua b/encoder.lua index 00941f9..6bae4f4 100644 --- a/encoder.lua +++ b/encoder.lua @@ -150,6 +150,8 @@ this.create_clip = function(clip_type, on_complete) 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 location_info = utils.file_info(output_dir_path) if not location_info.is_dir then diff --git a/helpers.lua b/helpers.lua index 786ce37..8ccd137 100644 --- a/helpers.lua +++ b/helpers.lua @@ -83,4 +83,16 @@ this.human_readable_time = function(seconds) return ret 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