summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-16 12:57:08 +0800
committerGitHub <[email protected]>2017-05-16 12:57:08 +0800
commitcbfbc9762e007654055ba3ec411de8cfc28e1bd1 (patch)
treec81b8cb6f43dd5929e1edc0beb57ab075c965ebc /xmake/plugins/lua
parenta7c6ffab557760c2c2adf69e4f646c678f4e3034 (diff)
parent37b4a7647163afdd392c7afcc61955244b6117cb (diff)
Merge pull request #93 from TitanSnow/command
add -c cmdline option for task lua
Diffstat (limited to 'xmake/plugins/lua')
-rw-r--r--xmake/plugins/lua/xmake.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index ba872f9cf..0b867d966 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
@@ -84,8 +93,10 @@ task("lua")
-- options
, options =
{
+
{'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 name, file or module and enter interactive mode if no given script.",
".e.g",
" - xmake lua (enter interactive mode)",