summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-16 16:28:02 +0800
committerruki <[email protected]>2020-02-16 16:28:02 +0800
commit8368581d63ff27a0edc3928a8a391b2cf3e1e4bc (patch)
treeded2dcd7677beeee210237e6261002e1e3c20c38 /xmake/plugins/lua/main.lua
parent5b53e98c61bda63722bffd82dad88778a886a6e1 (diff)
improve 'require --extra'
Diffstat (limited to 'xmake/plugins/lua/main.lua')
-rw-r--r--xmake/plugins/lua/main.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/plugins/lua/main.lua b/xmake/plugins/lua/main.lua
index aa6cab807..2fae8a0c6 100644
--- a/xmake/plugins/lua/main.lua
+++ b/xmake/plugins/lua/main.lua
@@ -41,6 +41,7 @@ function _list()
end
end
+-- print verbose log
function _print_vlog(script_type, script_name, args)
if not option.get("verbose") then return end
cprintf("running %s ${underline}%s${reset}", script_type, script_name)
@@ -103,7 +104,10 @@ function _run_script(script, args)
printresult = true
end
+ -- print verbose log
_print_vlog(script_type or "script", script_name or "", args)
+
+ -- dump result
local result = table.pack(func(table.unpack(args, 1, args.n)))
if printresult and result and result.n ~= 0 then
utils.dump(unpack(result, 1, result.n))
@@ -112,19 +116,20 @@ end
function _get_args()
+ -- get arguments
local args = option.get("arguments") or {}
args.n = #args
+ -- get deserialize tag
local deserialize = option.get("deserialize")
if not deserialize then
return args
end
-
deserialize = tostring(deserialize)
+ -- deserialize prefixed arguments
for i, value in ipairs(args) do
if value:startswith(deserialize) then
- -- deserialize prefixed arg
local v, err = string.deserialize(value:sub(#deserialize + 1))
if err then
raise(err)
@@ -133,12 +138,12 @@ function _get_args()
end
end
end
-
return args
end
function main()
+ -- list builtin scripts
if option.get("list") then
return _list()
end