Skip to content
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

Merged
merged 1 commit into from
Feb 17, 2017
Merged

Fix coloring on cygwin/msys2 shell #61

merged 1 commit into from
Feb 17, 2017

Conversation

fatih
Copy link
Owner

@fatih fatih commented Feb 17, 2017

Closes #57

@fatih
Copy link
Owner Author

fatih commented Feb 17, 2017

/cc @mattn

@mattn
Copy link
Contributor

mattn commented Feb 17, 2017

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()))

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.

Copy link
Owner Author

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?

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.

@fatih
Copy link
Owner Author

fatih commented Feb 17, 2017

@mattn @k-takata pushed again, ptal

@mattn
Copy link
Contributor

mattn commented Feb 17, 2017

LGTM

@fatih
Copy link
Owner Author

fatih commented Feb 17, 2017

Thanks @mattn , rebased and merging once it's green

@mattn
Copy link
Contributor

mattn commented Feb 17, 2017

color.Green("YAY")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants