Many cli go programs use https://github.com/mattn/go-isatty ( used by https://github.com/fatih/color ) to determine if they should print colored output. If there is some way to "fool" that from, that could work.
It seems silly to ask each cli program to check a env var to see if they are running inside a taskfile.
PTY redirection could work too. That way we should natively pass the "isatty" check.
Any other thoughts here?
I'd really like to use task _ exclusively but I like my colors too much (e.g.. for golangci-lint).
Hi @mehcode,
Thanks for reporting! I'll try a patch to fatih/color
Hi again @mehcode,
Unfortunately fatih/color is not maintained anymore, and PTY redirection is hard to implement (and potentially not cross-platform).
In the meantime, your best option is opening issues or pull requests on your favorite tools to support forcing colored output. For example, I just found that Gulp has a --color flag to force it, that work for Task. Other tools have specific flags or environment variables to do it.
@andreynering any news on this for universal solution? I'm using a simply go run for a chi router program. What can I do?
@frederikhors
What can I do?
For now you should search for a way to force colored output from Chi (most likely a flag or environment variable). If that doesn't exist, consider opening an issue or pull request on that project.
For many CLI programs, there is no way to force colored output, e.g. https://www.npmjs.com/package/ask-cli and https://rollupjs.org
I think it unreasonable to force every CLI program to have such an option.
make shows colors. No idea how it does it. But feature-wise, make is a benchmark for every build tool. :)
It would be lovely to see this feature in the long term.
Hi @mehcode @frederikhors @alexbepple,
Can you try the new release and report if you see any improvements?
@andreynering: Colorized output now seems to be working for me in 2.5.1 (the same as it did before the 2.0.3 update). So at least from my perspective, this seems fixed now. Thanks!
@GUI Thanks for letting me know
Closing this for now.
If anyone still experience this issue, let me know.
Most helpful comment
For many CLI programs, there is no way to force colored output, e.g. https://www.npmjs.com/package/ask-cli and https://rollupjs.org
I think it unreasonable to force every CLI program to have such an option.
makeshows colors. No idea how it does it. But feature-wise,makeis a benchmark for every build tool. :)It would be lovely to see this feature in the long term.