diff options
| author | ruki <[email protected]> | 2017-08-14 11:27:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-14 11:29:30 +0800 |
| commit | dba45d143d8aff047da82cbe1a881056e6e4bc00 (patch) | |
| tree | 7b80d5de264c17b538a7c9d0fbb234ded39ac683 /xmake/core/sandbox/modules/utils.lua | |
| parent | 34706ba053dda9dd86902cacf42a6c1878c85234 (diff) | |
merge repo and require codes
Diffstat (limited to 'xmake/core/sandbox/modules/utils.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index 40d2c6170..e282ef80e 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -26,6 +26,7 @@ local io = require("base/io") local utils = require("base/utils") local colors = require("base/colors") +local option = require("base/option") local try = require("sandbox/modules/try") local catch = require("sandbox/modules/catch") local vformat = require("sandbox/modules/vformat") @@ -72,7 +73,7 @@ function sandbox_utils.print(format, ...) { function () -- attempt to print format string first - utils._iowrite(vformat(format, unpack(args)) .. "\n") + utils._print(vformat(format, unpack(args))) end, catch { @@ -100,7 +101,7 @@ end function sandbox_utils.cprint(format, ...) -- done - utils._iowrite(colors(vformat(format, ...)) .. "\n") + utils._print(colors(vformat(format, ...))) end -- print format string, the builtin variables and colors without newline @@ -110,6 +111,20 @@ function sandbox_utils.cprintf(format, ...) utils._iowrite(colors(vformat(format, ...))) end +-- print() if enable verbose +function sandbox_utils.vprint(format, ...) + if option.get("verbose") then + sandbox_utils.print(format, ...) + end +end + +-- vprintf() if enable verbose +function sandbox_utils.vprintf(format, ...) + if option.get("verbose") then + sandbox_utils.printf(format, ...) + end +end + -- assert function sandbox_utils.assert(value, format, ...) @@ -126,7 +141,6 @@ function sandbox_utils.assert(value, format, ...) return value end - -- return module return sandbox_utils |
