作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以,我在 中安装了 colormake徐邦图 18.04 , 设置 alias make='colormake'
当我输入 make
时,它可以完美运行:
问题是,如果我尝试在静默/安静模式下使用 make,也就是 make -s
,输出只有灰色:
我想我错过了关于 make 或 colormake 如何工作的一些东西。任何人都知道如何使它正常工作?不幸的是,我已经看到 colormake 不再被维护了,所以我想没有什么正式的东西可以寻找......
最佳答案
好吧,几天后,我有时间自己研究一下。
似乎它与静音模式无关:它只是在 中更改一些东西。 Perl 脚本 /usr/share/colormake/colormake.pl
.我不知道 Perl,但由于脚本很简单(并且有点像 bash),我能够花一些时间按照自己的意愿编辑它。
如果它对任何人有帮助,这就是我所做的:
# Some useful color codes, see end of file for more.
# tput used to automatically detect best combination for current shell
$bold=`tput bold`;
$normal=`tput sgr0`;
$col_black = "\033[30m";
$col_red = "\033[31m";
$col_green = "\033[32m";
$col_yellow = "\033[33m";
$col_blue = "\033[34m";
$col_magenta = "\033[35m";
$col_cyan = "\033[36m";
$col_ltgray = "\033[37m";
$col_drkgray = "\033[1;30m";
$col_purple = "\033[35m",
$col_white = "\033[37m",
$col_norm = "\033[00m";
$col_background = "\033[07m";
$col_brighten = "\033[01m";
$col_underline = "\033[04m";
$col_blink = "\033[05m";
# Customize colors here...
$col_default = $col_ltgray;
$col_gcc = $col_magenta . $col_brighten;
$col_make = $col_cyan;
$col_filename = $col_drkgray;
$col_linenum = $col_blue . $col_brighten;
$col_trace = $col_green;
$col_warningtag = $col_yellow . $bold;
$col_warning = $col_yellow;
$col_comment = $col_drkgray;
$col_errortag = $col_red . $bold;
$col_error = $col_red;
$error_highlight = $col_brighten;
# Read in config files: system first, then user
for $file ("/usr/share/colormake/colormake.rc", "$ENV{HOME}/.colormakerc")
{
unless (!-f $file or do $file)
{
warn "couldn't parse $file: $@" if $@;
}
}
# Get size of terminal
$lines = shift @ARGV || 0;
$cols = shift @ARGV || 0;
$cols -= 19;
$in = 'unknown';
$| = 1;
$skip = 0;
# Treat cases
while (<>)
{
$orgline = $thisline = $_;
# Remove multiple spaces
$thisline =~ s/ \+/ /g;
# Skip lines
$skip--;
if ($skip < 0)
{
$skip = 0;
}
# make[1]: Entering directory `/blah/blah/blah'
if ($thisline =~ s/^((p|g)?make\[)/$col_make$1/x)
{
$in = 'make';
} # Some compiler tools
elsif ($thisline =~ s/^(\s*(libtool:\s*)?((compile|link):\s*)?(([[:ascii:]]+-)?g?(cc|\+\+)|(g|c)\+\+|clang|CC|CXX).*)$/$col_gcc$1$col_norm/)
{
$in = 'gcc';
if ($thisline =~ /\W-MF\W/)
{
$skip = 2;
}
} # Comments
elsif ($thisline =~ s/^\#/$col_comment#$1/x)
{
$in = 'comment';
}
elsif (!$skip && $thisline =~ /^(\s*\(|\[|a(r|wk)|c(p|d|h(mod|own))|do(ne)?|e(cho|lse)|f(ind|or)|i(f|nstall)|mv|perl|r(anlib|m(dir)?)|s(e(d|t)|trip)|tar)\s+/)
{
$in = $1;
}
elsif ($thisline !~ /^mv\W/)
{
# Do interesting things if make is compiling something.
if (($thisline !~ /[,:]$/) && ($thisline !~ /warning/))
{
if ($thisline =~ /[,:]$/) {
print "\t\t\t\t[,:]\$ matched --> '$thisline\n'";
}
$thisline =~ s|(error:\s+)(.*)$|$col_errortag ERROR: $normal$col_error$2$normal|;
$thisline =~ s/(\d+:\s+)/$1$col_default$col_error/;
$thisline = $thisline . $col_norm;
}
else
{
# Warning
if ($thisline =~ /(warning:\s+)(.*)$|/) {
$thisline =~ s|(warning:\s+)(.*)$|$col_warning WARNING: $normal$col_warning$2$normal|;
}
}
# In file included from main.cpp:38:
# main.cpp: In function int main(...)':
$thisline =~ s/(In\sf(unction|ile))/$col_trace$1/x;
# /blah/blah/blah.cpp:123:
$thisline =~ s|^([\.\/:]*)([[:graph:]]+)(\.[a-z])|$col_filename$1$2$3$col_default|;
# Line number
$thisline =~ s|:(\d+)([:,])|:$col_linenum$1$col_default$2|;
#}
}
if ($thisline !~ /^\s+/)
{
print $col_norm, $col_default;
}
print $thisline;
}
print $col_norm;
这是结果
关于ubuntu - 静音模式的配色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70563926/
我是一名优秀的程序员,十分优秀!