muesli / termenv

Advanced ANSI style & color support for your terminal applications
MIT License
1.76k stars 73 forks source link

No color with version > 0.9.0 #98

Closed alswl closed 2 years ago

alswl commented 2 years ago

After upgrade to 0.12.0, I found my cli is running with no color. After seeking problems, I found termenv' version is the root casue.

Show the code:

git clone git@github.com:alswl/bubble-table.git
g rev-parse HEAD
635b501f4a8b900b93291b3841eadabf16d78295
cat go.mod | grep termenv
        github.com/muesli/termenv v0.9.0 // indirect
go mod tidy; go run examples/features/main.go
image

After upgrade:

gsed -i 's/termenv v0.9.0/termenv v0.10.0/g' go.mod
go mod tidy; go run examples/features/main.go
image

And the latest 0.12.0 still not works for me.

My system versions:

➜  bubble-table git:(main) ✗ neofetch
                    'c.          ?
                 ,xNMM.          -------------------------------
               .OMMMMo           OS: macOS 12.6 21G115 arm64
               OMMM0,            Host: MacBookPro18,1
     .;loddo:' loolloddol;.      Kernel: 21.6.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 3 days, 1 hour, 41 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 502 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1728x1117, 2560x1440
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Light)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: tmux
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M1 Pro
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M1 Pro
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 5563MiB / 32768MiB
       .cooc,.    .,coo:.
muesli commented 2 years ago

Can you check & share the values of the following environment variables, please:

muesli commented 2 years ago

Since the CI check wasn't in v0.9.0 yet, I'm assuming the CI environment variable has some value on your system?

alswl commented 2 years ago

@muesli The reproduce process between version did not modified any ENV or others settings.

My environments variables:

➜  ~ echo $TERM
screen-256color
➜  ~ echo $COLORTERM
truecolor
➜  ~ echo $TERM_PROGRAM
tmux
➜  ~ echo $CI
true
➜  ~ echo $TERM_PROGRAM
tmux
➜  ~ echo $NO_COLOR
muesli commented 2 years ago

➜ ~ echo $CI true

Unsetting this variable will enable the colored output again. It's something I had to introduce because some CIs (CircleCI) in particular just time out responding to OSC messages.

alswl commented 2 years ago

@muesli Thanks for you reply, it works for me.

It's so weird that I didn't explicitly specify that my environment has this CI variable.

alswl commented 2 years ago

I found the settings finally.

Another cli command using this variable for indicate upgrade or not.

# disable waque auto upgrade
export CI=true
muesli commented 2 years ago
# disable waque auto upgrade
export CI=true

That seems rather odd and a bit of a misuse of this particular env var.

You can alternatively enforce colors with the CLICOLOR_FORCE env var. In code, you could pass your own environment to termenv or set a fixed profile.

alswl commented 2 years ago

@muesli Thanks for your patient guide.