Piping colored output into Less


(Roger Alexander) #1

Hi,
I’m trying to get the colored output from gradle to be displayed by less on Mac OS X. I’ve tried ‘gradle --console rich tasks | less -r’ (and also ‘gradle --console rich tasks | less -R’), but to no avail. I’m running Mac OS X 10.10.3, with Zsh as my shell.

Any suggestions would be greatly appreciated.

Thanks,

Roger Alexander.


(Karol Wrótniak) #2

I see that is old topic but I faced the same problem and found the solution. Maybe it will be useful for someone.
One of the ways to do that is redirect stderr to stdout, like that:
gradle --console rich tasks 2>&1 |less -R


(radistao) #3

gradle --console rich tasks 2>&1 | less -r
( -r is --raw-control-chars)
looks better - it skips 0% CONFIGURING outputs.