diff options
| author | TitanSnow <[email protected]> | 2017-05-16 12:09:06 +0800 |
|---|---|---|
| committer | TitanSnow <[email protected]> | 2017-05-16 12:09:06 +0800 |
| commit | 3129cd5005814ddd4fba736f127bf7f13809d4b7 (patch) | |
| tree | 7fd715b4734219f090370be2884d4e3af87f32e6 /xmake/plugins/lua | |
| parent | 79634bd7f65737d619f87f6b38710195429843d0 (diff) | |
add -c cmdline option for task lua
Diffstat (limited to 'xmake/plugins/lua')
| -rw-r--r-- | xmake/plugins/lua/xmake.lua | 12 |
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." } } |
