-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coloring on cygwin/msys2 shell #61
Conversation
/cc @mattn |
color.go
Outdated
@@ -18,8 +18,7 @@ var ( | |||
// or not. This is a global option and affects all colors. For more control | |||
// over each color block use the methods DisableColor() individually. | |||
NoColor = os.Getenv("TERM") == "dumb" || | |||
!isatty.IsTerminal(os.Stdout.Fd()) || | |||
!isatty.IsCygwinTerminal(os.Stdout.Fd()) | |||
(!isatty.IsTerminal(os.Stdout.Fd()) || !isatty.IsCygwinTerminal(os.Stdout.Fd())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still wrong, I think.
If both IsTerminal() and IsCygwinTerminal() return false, color cannot be used.
At least one of them returns true, color can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously it was like:
NoColor = os.Getenv("TERM") == "dumb" ||
!isatty.IsTerminal(os.Stdout.Fd()) ||
!isatty.IsCygwinTerminal(os.Stdout.Fd())
Do you say it should be like this?
NoColor = os.Getenv("TERM") == "dumb" ||
!isatty.IsTerminal(os.Stdout.Fd()) ||
isatty.IsCygwinTerminal(os.Stdout.Fd())
I'm really confused right now. I don't have a way to test it, so can you test and give me the correct answer maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant:
NoColor = os.Getenv("TERM") == "dumb" ||
!(isatty.IsTerminal(os.Stdout.Fd()) ||
isatty.IsCygwinTerminal(os.Stdout.Fd()))
This is equivalent with @mattn's suggestion.
LGTM |
Thanks @mattn , rebased and merging once it's green |
color.Green("YAY") |
Closes #57