We need a tool to decolorise colorfull logs. Example: genkernel all | tee logfile ; cat logfile | mail plop@foo.bar ; rm logfile This is a case where we do not want to use the nocolor option of genkernel. But, if we send the email with color full log, it will not be readable. As workaround, I do this ATM: cat logfile | sed "s/.\[[0-9\;]*m//g" | mail foo@bar but, having a dedicated decolorising tool would be nice. And include it in an existing kit, like app-portage/gentoolkit ?
There are lots of ways to do this, but none of them are as good as not adding colour in the first place. Your workaround fixes the problem of colour having been added in the first place. Maybe you should write a little script, put it in /usr/local/bin and pipe all mail through there. Or you could do that work automatically on the receiving end, perhaps using a procmail recipe to filter control sequences from mail (using that oneliner of yours) coming in from specific hosts. If you figure a way to do this systematically, other than not producing colour in output in the first place[1], then please let us know. Having an open bug about this doesn't make sense otherwise. It's probably better to bring this to a wider audience, say the gentoo-dev@ mailing list. [1] By setting NOCOLOR=true in make.conf, which still doesn't strip colour from the output of dev-util/cmake and like build systems, but only from emerge itself.