summaryrefslogtreecommitdiff
path: root/lib/spack/llnl/util/tty/color.py
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-10-13 10:35:19 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2015-10-13 10:35:19 -0700
commitd16095c8560cbaae1020a8e84494b8877bfe36f5 (patch)
tree145093825da16dd028f9bfd3a6fd82bd7d32c42e /lib/spack/llnl/util/tty/color.py
parent2c81875019803af7b7f08b070f37c45e51a3c7d5 (diff)
downloadspack-d16095c8560cbaae1020a8e84494b8877bfe36f5.tar.gz
spack-d16095c8560cbaae1020a8e84494b8877bfe36f5.tar.bz2
spack-d16095c8560cbaae1020a8e84494b8877bfe36f5.tar.xz
spack-d16095c8560cbaae1020a8e84494b8877bfe36f5.zip
Add forgotten file from previous commit.
Diffstat (limited to 'lib/spack/llnl/util/tty/color.py')
-rw-r--r--lib/spack/llnl/util/tty/color.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/spack/llnl/util/tty/color.py b/lib/spack/llnl/util/tty/color.py
index 22080a7b37..0d09303da0 100644
--- a/lib/spack/llnl/util/tty/color.py
+++ b/lib/spack/llnl/util/tty/color.py
@@ -158,6 +158,11 @@ def clen(string):
return len(re.sub(r'\033[^m]*m', '', string))
+def cextra(string):
+ """"Length of extra color characters in a string"""
+ return len(''.join(re.findall(r'\033[^m]*m', string)))
+
+
def cwrite(string, stream=sys.stdout, color=None):
"""Replace all color expressions in string with ANSI control
codes and write the result to the stream. If color is