diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-11-01 23:55:29 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-11-01 23:55:29 +0000 |
commit | fffe4a8f8fb082db1b211aad2402003622ba3cfc (patch) | |
tree | e785e0b02270a8a3b63fda5c7e6eb0be4d8845dd /pym | |
parent | 5cabd395cb44f4b66fe5ab9d747294d8804f438e (diff) | |
download | portage-fffe4a8f8fb082db1b211aad2402003622ba3cfc.tar.gz portage-fffe4a8f8fb082db1b211aad2402003622ba3cfc.tar.bz2 portage-fffe4a8f8fb082db1b211aad2402003622ba3cfc.zip |
Implement --color < y | n > for bug #42115 and deprecate --nocolor. When --color is not specified, rely on the old NOCOLOR variable and/or stdout auto-detection.
svn path=/main/trunk/; revision=4906
Diffstat (limited to 'pym')
-rw-r--r-- | pym/output.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pym/output.py b/pym/output.py index 4ff7ce5f7..62ec975fe 100644 --- a/pym/output.py +++ b/pym/output.py @@ -210,15 +210,18 @@ def notitles(): def nocolor(): "turn off colorization" + global havecolor havecolor=0 - for x in codes.keys(): - codes[x]="" def resetColor(): return codes["reset"] def colorize(color_key, text): - return codes[color_key] + text + codes["reset"] + global havecolor + if havecolor: + return codes[color_key] + text + codes["reset"] + else: + return text compat_functions_colors = ["bold","white","teal","turquoise","darkteal", "fuscia","fuchsia","purple","blue","darkblue","green","darkgreen","yellow", |