Curtis just gave me this incredibly handy piece of code that higlights errors and warnings in make output. Now, when I’m building, all the warnings are highlighted in yellow, and the errors in red. Just put the following in your bash profile script:
make() { pathpat="(/[^/]*)+:[0-9]+" ccred=$(echo -e "\033[0;31m") ccyellow=$(echo -e "\033[0;33m") ccend=$(echo -e "\033[0m") /usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&$ccend%g" return ${PIPESTATUS[0]} }
Of course, improvements and more ideas welcome! Thanks goes to Curtis for this!
10 replies on “Highlight Warnings in Make”
Absolutely delicious. Thank you!
Looks nice, but wordpress seems to have messed many of the quote characters.
@Hanspeter
I think if you drag and copy, you should be good. I don’t see any escape issues – just some layout truncation issues.
On Linux, you can just install the ‘colormake’ package and use that in place of make.
(colormake should work on non-Linux platforms, too — you’d just need to download the perl & bash scripts and put them in the right places yourself)
More info:
http://bre.klaki.net/programs/colormake/
Nope. It’s giving me curly quotes for the terminating quote on the first line, the opening quote on the 2nd line, and the ones around warning in the 2nd to last line. If you look at the source code of this page, wordpress is converting the quote characters into & # 8221; and & # 8220; (hopefully I spaced that out enough that it won’t convert them into the actual characters here…)
(on windows, but obviously the wordpress output is system agnostic)
Any way we can get this styling applied to the buildlogs submitted to tinderbox so that it’s easier to spot the problems when investigating a failed build?
[…] via shawnwilsher.com […]
@Mike
I honestly don’t know.
\o/
for sed, -E appears to be an OSX only flag. I think the linux equivalent is -r, so: