diff options
| author | ruki <[email protected]> | 2022-09-10 23:48:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-10 23:48:40 +0800 |
| commit | 43ca57ce4252e4c2bce03b04ce04bb2f1245b01a (patch) | |
| tree | 06eeec0c1e8521cb47d1445c59a6b1c2049d6c6b | |
| parent | 604f6fc19a82797c58361f86a1adf07a8f68677b (diff) | |
format code
| -rw-r--r-- | xmake/core/sandbox/modules/try.lua | 5 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 32 |
2 files changed, 0 insertions, 37 deletions
diff --git a/xmake/core/sandbox/modules/try.lua b/xmake/core/sandbox/modules/try.lua index 5fa12fff0..0133c20b7 100644 --- a/xmake/core/sandbox/modules/try.lua +++ b/xmake/core/sandbox/modules/try.lua @@ -77,12 +77,8 @@ function sandbox_try._traceback(errors) else results = results .. string.format(" [%s:%d]:\n", info.short_src, info.currentline) end - - -- next level = level + 1 end - - -- ok? return results end @@ -133,7 +129,6 @@ function sandbox_try.try(block) funcs.finally(ok, table.unpack(results, 2, results.n)) end - -- ok? if ok then return table.unpack(results, 2, results.n) end diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index b2f9a682a..d010f2c22 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -43,8 +43,6 @@ sandbox_utils.ifelse = utils.ifelse -- print each arguments function sandbox_utils._print(...) - - -- format each arguments local args = {} for _, arg in ipairs({...}) do if type(arg) == "string" then @@ -53,11 +51,7 @@ function sandbox_utils._print(...) table.insert(args, arg) end end - - -- print multi-variables with raw lua action utils._print(table.unpack(args)) - - -- write to the log file log:printv(table.unpack(args)) end @@ -69,58 +63,38 @@ function sandbox_utils.print(format, ...) -- print format string if type(format) == "string" and format:find("%", 1, true) then - local args = {...} try { function () - -- attempt to format message local message = vformat(format, table.unpack(args)) - - -- trace utils._print(message) - - -- write to the log file log:printv(message) end, catch { function (errors) - -- print multi-variables with raw lua action sandbox_utils._print(format, table.unpack(args)) end } } else - -- print multi-variables with raw lua action sandbox_utils._print(format, ...) end end -- print format string and the builtin variables without newline function sandbox_utils.printf(format, ...) - - -- init message local message = vformat(format, ...) - - -- trace utils._iowrite(message) - - -- write log to the log file log:write(message) end -- print format string, the builtin variables and colors with newline function sandbox_utils.cprint(format, ...) - - -- init message local message = vformat(format, ...) - - -- trace utils._print(colors.translate(message)) - - -- write log to the log file if log:file() then log:printv(colors.ignore(message)) end @@ -128,14 +102,8 @@ end -- print format string, the builtin variables and colors without newline function sandbox_utils.cprintf(format, ...) - - -- init message local message = vformat(format, ...) - - -- trace utils._iowrite(colors.translate(message)) - - -- write log to the log file if log:file() then log:write(colors.ignore(message)) end |
