COLOR-CODE编译器输出是否有简单的方法? [英] Is there an easy way to COLOR-CODE the compiler outputs?
本文介绍了COLOR-CODE编译器输出是否有简单的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
如果您正在寻找一些非常简单的方法,可以使用以下方法:
# !/ bin / bash -e
make $ {@} 2>& 1 | perl -wln -M'Term :: ANSIColor'-e'
m / Building | gcc | g ++ | \bCC\b | \bcc\b /并打印\e [1; 32m ,$ _,\e [0m]
或
m / Error / i并打印\e [1; 91m,$ _,\e [0m
或
m / Warning / i并打印\e [1; 93m,$ _,\e [0m
或
m / Linking | \\打印\e [1; 36m,$ _,\e [0m
或
print; '
只需将此脚本别名,并确保其可执行文件...
gcc (or other compilers) often generate huge text output and it's very difficult to see where the error is or miss warnings. I've done some search but havn't found a clean simple solution to color code the compiler output (so for instance warnings are yellow, errors are red, etc...)
解决方案
here's an alternative if you are looking for something very simple:
#!/bin/bash -e
make ${@} 2>&1 | perl -wln -M'Term::ANSIColor' -e '
m/Building|gcc|g++|\bCC\b|\bcc\b/ and print "\e[1;32m", "$_", "\e[0m"
or
m/Error/i and print "\e[1;91m", "$_", "\e[0m"
or
m/Warning/i and print "\e[1;93m", "$_", "\e[0m"
or
m/Linking|\.a\b/ and print "\e[1;36m", "$_", "\e[0m"
or
print; '
Just alias your make to this script and make sure it's executable...
这篇关于COLOR-CODE编译器输出是否有简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文