From b7b2e1892cebd8fb4dae23d7d2466c3d38c9f4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Sun, 9 Oct 2005 23:51:07 +0000 Subject: [PATCH] * implement --no-colors --- pisi/cli/colors.py | 4 +++- pisi/cli/commands.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pisi/cli/colors.py b/pisi/cli/colors.py index 676c18e8..a3ec8665 100644 --- a/pisi/cli/colors.py +++ b/pisi/cli/colors.py @@ -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 diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index 00faf0e9..111c0532 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -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):