Clojure is a wonderful language. The more I use it, the more I like it.
But the default error reporting is catastrophically bad, forcing you to look through screensful of Java stack-trace for the needle of a bit of code that’s actually yours.
I’m sure there are better solutions, but today I just hacked a very quick and dirty python program to filter this result, highlighting the lines that I care about.
#!/usr/bin/python
import sys
p = sys.argv[1]
for line in sys.stdin :
if p in line :
print ' 33[92m' + line + ' 33[0m',
else :
print line,
I made this code in an executable file called “colourit” in my bin directory. Now I can do this :
lein test |& colourit patterning
to, for example, highlight lines containing the word “patterning”.