Wednesday 30 October 2013

clang colorized html output

I love that clang has COLOURS in its output, but how to keep this formatting when copying the output to a file?

The solution is simple, add a -fcolor-diagnostics option and pipe the result to ansi2html. Of course since most of the interesting output is on stderr, don't forget to correctly redirect it (2>&1).

So in the end

$ clang -fcolor-diagnostics temp.c  2>&1 | ansi2html > temp.html

Many thanks to nemo for sharing this trick and several others on this blog!

No comments:

Post a Comment



All the projects here are under a Creative Commons 3.0 licence! You can use and distribute them as you like (just quote the author so he knows his work is not useless)!

If you wish to get in touch with me write at projectsymphony@gmail.com