diff options
| author | ruki <[email protected]> | 2017-09-04 21:26:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-09-04 21:26:48 +0800 |
| commit | 87362b49f7cd5547c14f47f3f47bc93a1987286f (patch) | |
| tree | 8a32172ddf387d7a9f147420e0842478e6b23d37 | |
| parent | 4fead28a91b650fd7268e708afdf4dc97935d454 (diff) | |
add switch to disable color output
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | xmake/actions/require/install.lua | 4 | ||||
| -rw-r--r-- | xmake/core/base/colors.lua | 8 |
3 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0188316bf..4fda050f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Move docs directory to xmake-docs repo * Improve install and uninstall actions and support DESTDIR and PREFIX envirnoment variables * Optimize to detect flags +* Add `COLORTERM=nocolor` to disable color output ### Bugs fixed @@ -360,6 +361,7 @@ * 移除docs目录,将其放置到独立xmake-docs仓库中,减少xmake.zip的大小,优化下载安装的效率 * 改进安装和卸载脚本,支持DESTDIR和PREFIX环境变量设置 * 通过缓存优化flags探测,加速编译效率 +* 添加`COLORTERM=nocolor`环境变量开关,禁用彩色输出 ### Bugs修复 diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua index 112cbcd15..16d2aea0a 100644 --- a/xmake/actions/require/install.lua +++ b/xmake/actions/require/install.lua @@ -40,6 +40,7 @@ function main(requires) return end + -- TODO -- enter environment environment.enter() @@ -107,6 +108,9 @@ function main(requires) action.install(instance) end + -- TODO add installed package infos to the given targets + -- ... + -- leave environment environment.leave() end diff --git a/xmake/core/base/colors.lua b/xmake/core/base/colors.lua index eb7295ea4..d1d96210d 100644 --- a/xmake/core/base/colors.lua +++ b/xmake/core/base/colors.lua @@ -110,6 +110,14 @@ colors._escape = string.char(27) .. '[%sm' -- support 256 colors? function colors.has256() + -- get $COLORTERM + colors._COLORTERM = colors._COLORTERM or os.getenv("COLORTERM") or "" + + -- no color? + if colors._COLORTERM == "nocolor" then + return false + end + -- this is supported if be not windows if os.host() ~= "windows" then return true |
