diff options
| author | ruki <[email protected]> | 2016-07-13 22:22:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-13 22:22:34 +0800 |
| commit | e9d8482903f7f765e1141d6cddea67cb9a1d7288 (patch) | |
| tree | 4ac792ff189a9c18efb35b32471450ecf15b2871 /xmake/core/sandbox/modules/utils.lua | |
| parent | 526ddbb858b9c49589ff071442b1cefe6913b182 (diff) | |
print colors
Diffstat (limited to 'xmake/core/sandbox/modules/utils.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index 877234602..2309e8518 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -23,6 +23,7 @@ -- load modules local io = require("base/io") local utils = require("base/utils") +local colors = require("base/colors") local vformat = require("sandbox/modules/vformat") local raise = require("sandbox/modules/raise") @@ -36,25 +37,34 @@ for k, v in pairs(utils) do end end --- print with the builtin variables and newline +-- print format string and the builtin variables with newline function sandbox_utils.print(format, ...) - -- print non-formated string - if type(format) ~= "string" then - return print(format, ...) - end - -- done io.write(vformat(format, ...) .. "\n") end --- printf with the builtin variables +-- print format string and the builtin variables without newline function sandbox_utils.printf(format, ...) -- done io.write(vformat(format, ...)) end +-- print format string, the builtin variables and colors with newline +function sandbox_utils.cprint(format, ...) + + -- done + io.write(colors(vformat(format, ...) .. "\n")) +end + +-- print format string, the builtin variables and colors without newline +function sandbox_utils.cprintf(format, ...) + + -- done + io.write(colors(vformat(format, ...))) +end + -- assert function sandbox_utils.assert(value, format, ...) |
