diff options
| author | ruki <[email protected]> | 2017-02-17 20:50:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-17 20:50:39 +0800 |
| commit | a388453e3d7a91cf2f17a1137197767521803071 (patch) | |
| tree | 06b502b5fd365a4c6b1aa448982a56de6cbab602 /xmake/core/base/utils.lua | |
| parent | cc7f4047231bbed2b6768ab38d8c836db27b4d40 (diff) | |
remove some trace
Diffstat (limited to 'xmake/core/base/utils.lua')
| -rw-r--r-- | xmake/core/base/utils.lua | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/xmake/core/base/utils.lua b/xmake/core/base/utils.lua index abcb0b261..030c10d5c 100644 --- a/xmake/core/base/utils.lua +++ b/xmake/core/base/utils.lua @@ -30,6 +30,24 @@ local option = require("base/option") local colors = require("base/colors") local string = require("base/string") +-- print string with newline +function utils._print(...) + + -- print it if not quiet + if not option.get("quiet") then + print(...) + end +end + +-- print string without newline +function utils._iowrite(...) + + -- print it if not quiet + if not option.get("quiet") then + io.write(...) + end +end + -- print format string with newline function utils.print(format, ...) @@ -37,7 +55,7 @@ function utils.print(format, ...) assert(format) -- trace - print(string.tryformat(format, ...)) + utils._print(string.tryformat(format, ...)) end -- print format string without newline @@ -47,7 +65,7 @@ function utils.printf(format, ...) assert(format) -- trace - io.write(string.tryformat(format, ...)) + utils._iowrite(string.tryformat(format, ...)) end -- print format string and colors with newline @@ -57,7 +75,7 @@ function utils.cprint(format, ...) assert(format) -- trace - print(colors(string.tryformat(format, ...))) + utils._print(colors(string.tryformat(format, ...))) end -- print format string and colors without newline @@ -67,7 +85,7 @@ function utils.cprintf(format, ...) assert(format) -- trace - io.write(colors(string.tryformat(format, ...))) + utils._iowrite(colors(string.tryformat(format, ...))) end -- the verbose function @@ -77,7 +95,7 @@ function utils.verbose(format, ...) if option.get("verbose") and format ~= nil then -- trace - print(string.tryformat(format, ...)) + utils._print(string.tryformat(format, ...)) end end |
