commit:     9a402fba0d63240685a2326926060c3c8c523101
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 15:22:55 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 15:22:55 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9a402fba

equery: Set nocolor for piping to after options are parsed

Fixes commit 84ffe42e5 which set nocolor before options were parsed.

Bug: https://bugs.gentoo.org/861116

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/equery/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/equery/__init__.py 
b/pym/gentoolkit/equery/__init__.py
index 56b2caa..ae760c1 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -228,8 +228,6 @@ def initialize_configuration():
         # set extra wide, should disable wrapping unless
         # there is some extra long text
         CONFIG["termWidth"] = 600
-        # turn off color
-        pp.output.nocolor()
 
     CONFIG["debug"] = bool(os.getenv("DEBUG", False))
 
@@ -338,6 +336,10 @@ def main(argv):
     else:
         CONFIG["verbose"] = True
 
+    if CONFIG["piping"]:
+        # turn off color
+        pp.output.nocolor()
+
     try:
         module_name, module_args = split_arguments(args)
     except IndexError:

Reply via email to