summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/util/terminal.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py
index 9038c1f54..6bf85f14d 100644
--- a/src/python/m5/util/terminal.py
+++ b/src/python/m5/util/terminal.py
@@ -93,6 +93,15 @@ if sys.stdout.isatty():
else:
tty_termcap = no_termcap
+def get_termcap(use_colors = None):
+ if use_colors:
+ return termcap
+ elif use_colors is None:
+ # option unspecified; default behavior is to use colors iff isatty
+ return tty_termcap
+ else:
+ return no_termcap
+
def test_termcap(obj):
for c_name in color_names:
c_str = getattr(obj, c_name)