d059a55b85
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import sys
|
|
import os
|
|
import termcolor
|
|
import re
|
|
|
|
make_colors = dict()
|
|
make_attrs = dict()
|
|
|
|
def add_color_attr(field, color, *attrs):
|
|
make_colors[field] = color
|
|
make_attrs[field] = attrs
|
|
|
|
add_color_attr("Kernel:", "blue", "bold")
|
|
add_color_attr("is", "blue", "bold")
|
|
add_color_attr("ready", "blue", "bold")
|
|
add_color_attr("CC", "cyan", "bold")
|
|
add_color_attr("[M]", "magenta", "bold")
|
|
add_color_attr("MODPOST", "magenta", "bold")
|
|
add_color_attr("MODINFO", "magenta", "bold")
|
|
add_color_attr("DESCEND", "white", "dark")
|
|
add_color_attr("objtool", "yellow", "dark", "bold")
|
|
add_color_attr("LD", "yellow")
|
|
|
|
for line in sys.stdin:
|
|
if line[0] == "#":
|
|
termcolor.cprint(line, "blue", attrs=["dark", "bold"], end="")
|
|
else:
|
|
for part in re.split(r'(\s+)', line):
|
|
if "/" in part or "(#" in part or os.path.exists(part):
|
|
color = "magenta" if re.match("module", part, re.I) else "white"
|
|
attrs = ["bold"]
|
|
else:
|
|
color = make_colors.get(part, "green")
|
|
attrs = make_attrs.get(part, [])
|
|
termcolor.cprint(part, color, attrs=attrs, end="")
|