parent
c9cabb3666
commit
5b52c7eceb
5 changed files with 39 additions and 37 deletions
|
|
@ -256,6 +256,12 @@ def colorgen(stream, pattern, color="red", style="normal", on_groups=False):
|
||||||
yield colorup(item, pattern, color, style, on_groups)
|
yield colorup(item, pattern, color, style, on_groups)
|
||||||
|
|
||||||
|
|
||||||
|
def colortheme(item, theme):
|
||||||
|
for args in theme:
|
||||||
|
item = colorup(item, *args)
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# Command line tools #
|
# Command line tools #
|
||||||
######################
|
######################
|
||||||
|
|
@ -405,7 +411,8 @@ if __name__ == "__main__":
|
||||||
break
|
break
|
||||||
if not item:
|
if not item:
|
||||||
break
|
break
|
||||||
colored = themes[pattern].theme(item)
|
th = themes[pattern].theme()
|
||||||
|
colored = colortheme( item, th )
|
||||||
write(colored)
|
write(colored)
|
||||||
|
|
||||||
# if pygments
|
# if pygments
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
|
|
||||||
|
def theme():
|
||||||
import colout
|
th = [
|
||||||
def theme( item ):
|
[ "^(Scanning dependencies of target)(.*)$",
|
||||||
item = colout.colorup( item,
|
"magenta,blue", "normal,bold" ],
|
||||||
"^(Scanning dependencies of target)(.*)$",
|
[ "^(Linking \w+ \w+ library)(\s.*/)(\w+.[aso]+)$",
|
||||||
"magenta,blue", "normal,bold" )
|
"magenta", "normal,normal,bold" ],
|
||||||
item = colout.colorup( item,
|
[ "^\[\s*[0-9]+%\]\s(Built target)(\s.*)$",
|
||||||
"^(Linking \w+ \w+ library)(\s.*/)(\w+.[aso]+)$",
|
"cyan,blue", "normal,bold" ],
|
||||||
"magenta", "normal,normal,bold" )
|
[ "^\[\s*[0-9]+%\]\s(Building \w* object)(\s.*/)(\w+.cpp)(.o)$",
|
||||||
item = colout.colorup( item,
|
"green", "normal,normal,bold,normal"]
|
||||||
"^\[\s*[0-9]+%\]\s(Built target)(\s.*)$",
|
]
|
||||||
"cyan,blue", "normal,bold")
|
|
||||||
item = colout.colorup( item,
|
|
||||||
"^\[\s*[0-9]+%\]\s(Building \w* object)(\s.*/)(\w+.cpp)(.o)$",
|
|
||||||
"green", "normal,normal,bold,normal")
|
|
||||||
|
|
||||||
percs={
|
percs={
|
||||||
"\s":("magenta","normal"),
|
"\s":("magenta","normal"),
|
||||||
|
|
@ -29,6 +25,6 @@ def theme( item ):
|
||||||
"10":("red","bold"),
|
"10":("red","bold"),
|
||||||
}
|
}
|
||||||
for p in percs:
|
for p in percs:
|
||||||
item = colout.colorup( item, "^(\[)\s*("+p+"[0-9]%)(\])", "black,"+percs[p][0]+",black", percs[p][1] )
|
th.append( [ "^(\[)\s*("+p+"[0-9]%)(\])", "black,"+percs[p][0]+",black", percs[p][1] ] )
|
||||||
|
|
||||||
return item
|
return th
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import colout
|
|
||||||
def theme( item ):
|
|
||||||
item = colout.colorup( item, "error", "red", "bold" )
|
|
||||||
item = colout.colorup( item, "warning", "magenta", "bold" )
|
|
||||||
item = colout.colorup( item, "\[-W.*\]", "magenta", "normal" )
|
|
||||||
item = colout.colorup( item, "note", "blue", "bold" )
|
|
||||||
item = colout.colorup( item, ":([0-9]+):[0-9]*", "yellow", "normal" )
|
|
||||||
item = colout.colorup( item, "^((/\w+)+)\.(h|cpp)", "white", "normal" )
|
|
||||||
item = colout.colorup( item, "'(.*)'", "Cpp", "monokai" )
|
|
||||||
|
|
||||||
return item
|
def theme():
|
||||||
|
return [
|
||||||
|
[ "error", "red", "bold" ],
|
||||||
|
[ "warning", "magenta", "bold" ],
|
||||||
|
[ "\[-W.*\]", "magenta", "normal" ],
|
||||||
|
[ "note", "blue", "bold" ],
|
||||||
|
[ ":([0-9]+):[0-9]*", "yellow", "normal" ],
|
||||||
|
[ "^((/\w+)+)\.(h|cpp)", "white", "normal" ],
|
||||||
|
[ "'(.*)'", "Cpp", "monokai" ],
|
||||||
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
import colout
|
def theme():
|
||||||
def theme( item ):
|
return [
|
||||||
item = colout.colorup( item, '[{}]' )
|
[ '[{}]' ],
|
||||||
item = colout.colorup( item, '[:,]', "blue" )
|
[ '[:,]', "blue" ],
|
||||||
item = colout.colorup( item, '".*"', "green" )
|
[ '".*"', "green" ]
|
||||||
return item
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
import colout
|
def theme():
|
||||||
def theme( item ):
|
|
||||||
p="([rwxs-])"
|
p="([rwxs-])"
|
||||||
reg="^([d-])"+p*9+"\s.*$"
|
reg="^([d-])"+p*9+"\s.*$"
|
||||||
colors="blue"+",green"*3+",yellow"*3+",red"*3
|
colors="blue"+",green"*3+",yellow"*3+",red"*3
|
||||||
styles="normal"+ ",normal,italic,bold"*3
|
styles="normal"+ ",normal,italic,bold"*3
|
||||||
return colout.colorup( item, reg, colors, styles, True)
|
return [ [reg, colors, styles] ]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue