summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-02-06 16:58:23 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2014-02-06 16:58:23 -0800
commit73774c1249fb22f28b28346bd9ca5819104ce4c6 (patch)
treedf9bdeaaad45d423e87c40baa7caf8f9d6d445c6 /lib
parent72f0192dddc5ea89375ccbf219e5a0fd14a46df0 (diff)
downloadspack-73774c1249fb22f28b28346bd9ca5819104ce4c6.tar.gz
spack-73774c1249fb22f28b28346bd9ca5819104ce4c6.tar.bz2
spack-73774c1249fb22f28b28346bd9ca5819104ce4c6.tar.xz
spack-73774c1249fb22f28b28346bd9ca5819104ce4c6.zip
Spack message text is just bold, not bold white now.
- added capability for just bold and just underline to color.py - Make tty.msg() display bold text instead of bold white
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/color.py23
-rw-r--r--lib/spack/spack/tty.py6
2 files changed, 17 insertions, 12 deletions
diff --git a/lib/spack/spack/color.py b/lib/spack/spack/color.py
index 8d6a1d0218..9d75824aa8 100644
--- a/lib/spack/spack/color.py
+++ b/lib/spack/spack/color.py
@@ -42,6 +42,8 @@ Here are some example color expressions:
@r Turn on red coloring
@R Turn on bright red coloring
+ @*{foo} Bold foo, but don't change text color
+ @_{bar} Underline bar, but don't change text color
@*b Turn on bold, blue text
@_B Turn on bright blue text with an underline
@. Revert to plain formatting
@@ -80,9 +82,9 @@ class ColorParseError(spack.error.SpackError):
super(ColorParseError, self).__init__(message)
# Text styles for ansi codes
-styles = {'*' : '1;%s', # bold
- '_' : '4:%s', # underline
- None : '0;%s' } # plain
+styles = {'*' : '1', # bold
+ '_' : '4', # underline
+ None : '0' } # plain
# Dim and bright ansi colors
colors = {'k' : 30, 'K' : 90, # black
@@ -120,19 +122,22 @@ class match_to_ansi(object):
return '@'
elif m == '@.':
return self.escape(0)
- elif m == '@' or (style and not color):
+ elif m == '@':
raise ColorParseError("Incomplete color format: '%s' in %s"
% (m, match.string))
- elif color not in colors:
- raise ColorParseError("invalid color specifier: '%s' in '%s'"
- % (color, match.string))
+
+ string = styles[style]
+ if color:
+ if color not in colors:
+ raise ColorParseError("invalid color specifier: '%s' in '%s'"
+ % (color, match.string))
+ string += ';' + str(colors[color])
colored_text = ''
if text:
colored_text = text + self.escape(0)
- color_code = self.escape(styles[style] % colors[color])
- return color_code + colored_text
+ return self.escape(string) + colored_text
def colorize(string, **kwargs):
diff --git a/lib/spack/spack/tty.py b/lib/spack/spack/tty.py
index 02cd0364f6..5a2ba92275 100644
--- a/lib/spack/spack/tty.py
+++ b/lib/spack/spack/tty.py
@@ -29,7 +29,7 @@ from spack.color import *
indent = " "
def msg(message, *args):
- cprint("@*b{==>} @*w{%s}" % cescape(message))
+ cprint("@*b{==>} @*{%s}" % cescape(message))
for arg in args:
print indent + str(arg)
@@ -43,12 +43,12 @@ def info(message, *args, **kwargs):
def verbose(message, *args):
if spack.verbose:
- info(message, *args, format='*g')
+ info(message, *args, format='c')
def debug(*args):
if spack.debug:
- info("Debug: " + message, *args, format='*c')
+ info("Debug: " + message, *args, format='*g')
def error(message, *args):