From 02c98f12f87237facabef19094e755627e2db5ec Mon Sep 17 00:00:00 2001 From: inhere Date: Tue, 6 Apr 2021 18:25:33 +0800 Subject: [PATCH] up: update tests on windows OS. update readme --- .github/workflows/go.yml | 2 +- README.md | 6 ++++++ README.zh-CN.md | 6 ++++++ utils_test.go | 15 ++++++++++----- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c69e322..d69763e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - go_version: [1.11, 1.12, 1.13, 1.14, 1.15] + go_version: [1.11, 1.12, 1.13, 1.14, 1.15, 1.16] os: [ubuntu-latest, windows-latest, macOS-latest] steps: diff --git a/README.md b/README.md index dd8acc1..316a4c9 100644 --- a/README.md +++ b/README.md @@ -435,6 +435,12 @@ there are some useful functions reference - `RgbToHex(rgb []int) string` Convert RGB to hex code - More useful func please see https://pkg.go.dev/github.com/gookit/color +## Project use + +Check out these projects, which use https://github.com/gookit/color : + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI + ## Gookit packages - [gookit/ini](https://github.com/gookit/ini) Go config management, use INI files diff --git a/README.zh-CN.md b/README.zh-CN.md index fa4b393..8973882 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -403,6 +403,12 @@ s.Printf("style with %s\n", "options") - `RgbToHex(rgb []int) string` Convert RGB to hex code - 更多请查看文档 https://pkg.go.dev/github.com/gookit/color +## 使用color的项目 + +看看这些使用了 https://github.com/gookit/color 的项目: + +- https://github.com/Delta456/box-cli-maker Make Highly Customized Boxes for your CLI + ## Gookit 工具包 - [gookit/ini](https://github.com/gookit/ini) INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用 diff --git a/utils_test.go b/utils_test.go index ff451af..f2a35b7 100644 --- a/utils_test.go +++ b/utils_test.go @@ -55,18 +55,20 @@ ZSH_TMUX_TERM=screen-256color is.True(IsSupport16Color()) is.True(IsSupportColor()) }) +} + +func TestIsDetectColorLevel_unix(t *testing.T) { + if IsWindows() { + return + } + is := assert.New(t) - // TERM mockOsEnvByText("TERM=screen-256color", func() { is.Equal(Level256, DetectColorLevel()) is.False(IsSupportTrueColor()) is.True(IsSupport256Color()) is.True(IsSupportColor()) }) -} - -func TestIsDetectColorLevel_unix(t *testing.T) { - is := assert.New(t) // TERM_PROGRAM=Terminus mockOsEnvByText(` @@ -122,6 +124,9 @@ ZSH_TMUX_TERM=screen-256color } func TestIsDetectColorLevel_screen(t *testing.T) { + if IsWindows() { + return + } is := assert.New(t) // TERM_PROGRAM=Apple_Terminal use screen