MCPcopy Create free account
hub / github.com/NetSys/bess / ColorizedOutput

Class ColorizedOutput

bessctl/cli.py:36–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35
36class ColorizedOutput(object): # for pretty printing
37
38 def __init__(self, orig_out, color):
39 self.orig_out = orig_out
40 self.color = color
41
42 def __getattr__(self, attr):
43 def_color = '\033[0;0m' # resets all terminal attributes
44
45 if attr == 'write':
46 return lambda x: self.orig_out.write(self.color + x + def_color)
47 else:
48 return getattr(self.orig_out, attr)
49
50
51class CLI(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected