gjtorikian / html-proofer

Test your rendered HTML files to make sure they're accurate.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow color in non tty shell

sam-mcbr opened this issue · comments

I would like to use html-proofer in a CI job, but since the running is not a TTY shell there is no color output. Would love an environment variable or command line argument to force color output. Thanks!

Can you try setting the environment variable CLICOLOR_FORCE = '1' ?

Thanks for the quick response! Unfortunately still showing uncolored text

Would it be possible to see how you're setting that env var, or a sample workflow?

Terminal color output is dependent on https://github.com/ku1ik/rainbow/blob/138bc054cd196b54ed6a935c52653a8ac3761dfc/lib/rainbow.rb#L10-L12

html-proofer isn't doing any TTY determination, so I'm surprised the underlying library's mechanism isn't working.

Sorry for the delay, yeah I can share an example of how I was setting the var soon. But the reason I thought the TTY would affect this is I saw this line where Rainbow is only invoked if stdout is a TTY:

if (STDOUT_LEVELS.include?(level) && $stdout.isatty) ||

Could this be the cause of no color even with the env var set?

I guess Rainbow updated its logic at some point, because I see now that it handles TTY/color enabling on its own.

Could you try the branch at #818 and see if that works for you?

@gjtorikian Apologies for the long delay, I was able to confirm that this change enables colored output!

No worries, glad it worked, I'll send this out as 5.0.9 soon.