Jason Stubbs ([EMAIL PROTECTED]) scribbled:
> On Tuesday 12 April 2005 20:49, A. Khattri wrote:
> > There really ought to be a --nocolor option for emerge, alongside the
> > --nospinner option. (I know I could add it to FEATURES in make.conf but I
> > dont want to do that). I run emerge --sync from cron on my servers - the
> > email from cron contains a lot of control codes.
> 
> Well, that's three people saying it should be implemented but no offerings 
> off 
> any code yet... Here's my solution: Add NOCOLOR="true" to your crontab.

ehh, challenge accepted. :)

initial patch attached.  This is against 'emerge' from
sys-apps/portage-2.0.51.19.

it adds '--nocolor' with the abbreviation '-r'.  Looks like my tabs
might be off, let me know if they are.

I've never looked at this code before, nor this language.  So I'm sure I
screwed it up...

Cooper.
--- emerge.orig 2005-04-12 14:08:43.295986784 +0000
+++ emerge      2005-04-12 14:16:16.896029096 +0000
@@ -151,7 +151,7 @@
 "--fetchonly",    "--fetch-all-uri",
 "--getbinpkg",    "--getbinpkgonly",
 "--help",         "--noconfmem",
-"--newuse",
+"--newuse",                    "--nocolor",
 "--nodeps",       "--noreplace",
 "--nospinner",    "--oneshot",
 "--onlydeps",     "--pretend",
@@ -180,7 +180,7 @@
 "n":"--noreplace", "N":"--newuse",
 "o":"--onlydeps",  "O":"--nodeps",
 "p":"--pretend",   "P":"--prune",
-"q":"--quiet",
+"q":"--quiet",     "r":"--nocolor",
 "s":"--search",    "S":"--searchdesc",
 't':"--tree",
 "u":"--update",    "U":"--upgradeonly",
@@ -371,6 +371,10 @@
        portage.debug=1
        portage.settings.lock()
 
+# Set color output
+if ("--nocolor" in myopts) and (sys.stdout.isatty()):
+       nocolor()
+
 CLEAN_DELAY = 5
 EMERGE_WARNING_DELAY = 10
 if portage.settings["CLEAN_DELAY"]:

Reply via email to