When I developed this, a great majority of my professional development was in Perl. Additionally, we have had a focus on building more robust unit test scripts for the code that is written. Especially as the tests have started growing pretty large, I started looking for ways to make the test output a bit more readable. Since these are built using existing perl packages like Test::More, I am somewhat limited in my customization choices. When looking for possibilities, most of the answers that I found were code that you could add to your script to do the colorization. Unless I wanted to build custom versions of the packages we use, that wasn’t the best option.
I also looked into multitail since I had used that for colorizing some log outputs, but it never seemed well suited for taking the output of a single-run script. Not only is scrolling around a bit awkward, but it doesn’t tend to like to leave the output available after the run. Multitail does ok if you first redirect the output to a file, then multitail that file, but that is a bit more difficult to swing if you don’t want be switching between windows (plus it leaves a file that you’ll need to clean up at some point).
What I ended up going with was this script. The nice thing about it is that it could be pretty easily tailored for whatever script for which you wanted to colorize the output. As it is currently written, it makes the output of Perl’s Test::More .t files a lot clearer and nicer to look at!
To use it, I run something like perl test.t 2>&1 | ./colorize.sh
which results in output like this.
I’m sure that I could do some more customization, but I was pretty happy with how it turned out. It colorizes the different statements that we tend to have, and catches kill signals so your colors will reset to normal if you kill the run before it finishes. If I do make any updates, I’ll add them to the snippet.