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

Enable color by default only if os.Stdout is a TTY #6696

Merged
merged 3 commits into from
Jul 8, 2021

Conversation

ribasushi
Copy link
Collaborator

No description provided.

"github.com/mattn/go-isatty"
)

var DefaultColorUse = isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also have an env var for this? (LOTUS_COLOR=1, or sth like that, unless there is already a standard env var for that kind of thing)

Just isatty.IsTerminal will return false when running stuff in watch --color .. for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... we could introduce LOTUS_COLOR=1 OR we could recognize GOLOG_LOG_FMT=color which is a thing from ipfs/go-log

I can go either way, just suggesting an alternative for smaller amount of options to keep track of...

@magik6k say the word

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stebalien please be weighing in as well, I surely missed other stuff here too ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOLOG_LOG_FMT works for me

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k please be checking 4dd59b566ced

@ribasushi ribasushi requested a review from Stebalien July 8, 2021 06:25
@magik6k magik6k merged commit e258e7c into master Jul 8, 2021
@magik6k magik6k deleted the chore/even-less-color-on-cli branch July 8, 2021 10:05
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