add -c cmdline option for task lua
@@ -45,8 +45,17 @@ task("lua")
return
end
+ -- run command?
+ local cmd = option.get("command")
+ local name = nil
+ if cmd then
+ local tmpfile = os.tmpfile() .. ".lua"
+ io.writefile(tmpfile, "function main()\n" .. cmd .. "\nend")
+ name = tmpfile
+ end
+
-- get script name
- local name = option.get("script")
+ name = name or option.get("script")
if name then
-- import and run script
@@ -77,6 +86,7 @@ task("lua")
{
{'l', "list", "k", nil, "List all scripts." }
, {nil, "root", "k", nil, "Allow to run script as root." }
+ , {'c', "command", "kv", nil, "Run command" }
, {nil, "script", "v", nil, "Run the given lua script." }
, {nil, "arguments", "vs", nil, "The script arguments." }
}
