* implement --no-colors
This commit is contained in:
+3
-1
@@ -10,6 +10,8 @@
|
||||
|
||||
# Colors module provides some color codes for console output.
|
||||
|
||||
import pisi.context as ctx
|
||||
|
||||
colors = {'black' : "\033[30m",
|
||||
'red' : "\033[31m",
|
||||
'green' : "\033[32m",
|
||||
@@ -54,7 +56,7 @@ colors = {'black' : "\033[30m",
|
||||
|
||||
def colorize(msg, color):
|
||||
"""Colorize the given message for console output"""
|
||||
if colors.has_key(color):
|
||||
if colors.has_key(color) and not ctx.config.get_option('no_color'):
|
||||
return colors[color] + msg + colors['default']
|
||||
else:
|
||||
return msg
|
||||
|
||||
@@ -85,6 +85,8 @@ class Command(object):
|
||||
p.add_option("-n", "--dry-run", action="store_true", default=False,
|
||||
help = _("do not perform any action, just show what\
|
||||
would be done"))
|
||||
p.add_option("", "--no-color", action="store_true", default=False,
|
||||
help = _("print like a man"))
|
||||
return p
|
||||
|
||||
def options(self):
|
||||
|
||||
Reference in New Issue
Block a user