Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508338 - app-portage/pfl-2.4-r1: colour output of e-file cannot be disabled
Summary: app-portage/pfl-2.4-r1: colour output of e-file cannot be disabled
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Daniel Pielmeier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-21 17:12 UTC by Ulrich Müller
Modified: 2018-04-23 18:54 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
e-file with nocolor option (e-file,2.98 KB, application/x-shellscript)
2018-04-13 23:57 UTC, bugs
Details
e-file with nocolor option (e-file,3.10 KB, text/plain)
2018-04-15 16:51 UTC, Daniel Pielmeier
Details
diff to current version (e-file.diff,1.04 KB, patch)
2018-04-15 16:52 UTC, Daniel Pielmeier
Details | Diff
e-file with nocolor option (e-file,3.06 KB, application/x-shellscript)
2018-04-21 19:57 UTC, bugs
Details
diff to current version (e-file.patch,1.12 KB, patch)
2018-04-21 19:59 UTC, bugs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2014-04-21 17:12:31 UTC
There seems to be no way to suppress colored output for e-file:
- no option to control color
- no test if output is to a terminal (and not to a file)

To reproduce:
$ e-file foo > somefile  # output contains color codes


It would be nice if things were handled as in e.g., GNU ls:

       --color[=WHEN]
              colorize the output; WHEN can be 'never', 'auto', or 'always'
              (the default); more info below

With --color=auto, ls emits color codes only when standard output is connected to a terminal.
Comment 1 bugs 2018-04-13 23:57:54 UTC
Created attachment 527308 [details]
e-file with nocolor option

Hi,
you mean like the attached e-file script?

regards
Daniel
Comment 2 Daniel Pielmeier gentoo-dev 2018-04-15 16:51:59 UTC
Created attachment 527528 [details]
e-file with nocolor option

You also need the conditional for clearcolor else the color codes for white text are printed.

I have attached a version which fixes this. Additionally I tried to implement it as requested.

If called with:
nocolor - color is suppressed in any case
color - color is enabled in any case
auto - print with color if output is to terminal and without color if output is redirected to a file.
Comment 3 Daniel Pielmeier gentoo-dev 2018-04-15 16:52:31 UTC
Created attachment 527530 [details, diff]
diff to current version
Comment 4 bugs 2018-04-21 19:57:31 UTC
Created attachment 528172 [details]
e-file with nocolor option

Looks good. Minor change: initialized color variable.

And I also updated the URL as the old was ... well... very old :)
Comment 5 bugs 2018-04-21 19:59:38 UTC
Created attachment 528174 [details, diff]
diff to current version

diff to current version
Comment 6 Daniel Pielmeier gentoo-dev 2018-04-23 18:54:36 UTC
Fixed in Git with pfl-3.0.
Thanks for the report!