summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/xmake.lua
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-16 12:09:06 +0800
committerTitanSnow <[email protected]>2017-05-16 12:09:06 +0800
commit3129cd5005814ddd4fba736f127bf7f13809d4b7 (patch)
tree7fd715b4734219f090370be2884d4e3af87f32e6 /xmake/plugins/lua/xmake.lua
parent79634bd7f65737d619f87f6b38710195429843d0 (diff)
add -c cmdline option for task lua
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
-rw-r--r--xmake/plugins/lua/xmake.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index 1c6b2bf27..3e161cd4c 100644
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.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." }
}