Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[obsolete] portage-utils: Colored output to files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 163
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Tue Oct 27, 2020 12:55 am    Post subject: [obsolete] portage-utils: Colored output to files Reply with quote

[This thread is obsolete; second edit in Apr 2023]

[First edit of Apr 2023]
As of app-portage/portage-utils-0.94.3, (Apr 2023)
$ q
does print in color, but if you do
$ q > file
it will be colorless. For a workaround, see the next message by Ionen.

Don't submit a wish item to bugzilla and annoy Gentoo developers. If you can, please write a patch to accept an option:
--color=always/auto/never
i.e. as "ls (1)" does.

Thanks.

[Original message]
As of app-portage/portage-utils-0.90,
$ q
does print in color, but if you do
$ q > file
it will be colorless. I wrote a quick patch that makes outputs always in color, unless you pass --nocolor.

Get it here. Save it as /etc/portage/patches/app-portage/portage-utils/notty-color.patch, re-emerge, and you're done.

Don't send it to bugzilla and annoy Gentoo developers. Once you enhance it to
--color=always/auto/never
i.e. as "ls (1)" does, I guess it'll be ok.

Regards.
_________________
Hack of easy Shift / Ctrl / AltGr etc; save your pinkies, type without drudgery: topic 865313

BTRFS - Biden & TRump, Fools Suck.


Last edited by teika on Sat Apr 15, 2023 12:57 pm; edited 2 times in total
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2870

PostPosted: Tue Oct 27, 2020 1:13 am    Post subject: Reply with quote

If want to avoid patches in situations like that, can always force it with the script command (from util-linux), like:
Code:
script -aefq /dev/null -c "quse -Dvp firefox" | grep www-client > stillcolored
Can also replace /dev/null by the actual file and it'll work more like bin/tee. Given it makes the command a bit nasty, makes more sense with an alias/wrapper.

Not that I don't agree portage-utils needs an option to control this rather than be auto-detection-only.
Back to top
View user's profile Send private message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 163
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Sat Apr 15, 2023 1:43 am    Post subject: Reply with quote

Thanks. That workaround really helps.

(You're right. As you feared, my patch has to be updated now, and will need to be forever! ;-)
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2182

PostPosted: Sat Apr 15, 2023 10:07 am    Post subject: Reply with quote

RTFM?
Code:
quse --color firefox > q.lst

produces coloured output for me.
I'm on portage-utils-0.95
_________________
Greybeard
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2870

PostPosted: Sat Apr 15, 2023 10:40 am    Post subject: Reply with quote

Yeah, the --color option wasn't there when this thread was made, but it was added in portage-utils-0.92:
https://github.com/gentoo/portage-utils/commit/03c2d27602bc94aaa1660da7b084d40a9cf70f5d

It's probably the cause of the patch "needing" rebasing :)
Back to top
View user's profile Send private message
teika
Apprentice
Apprentice


Joined: 19 Feb 2011
Posts: 163
Location: YYYY-MM-DD, period. Have you ever used the Internet?

PostPosted: Sat Apr 15, 2023 1:04 pm    Post subject: Reply with quote

@Goverp, Ionen

Sorry & thanks for replying to my obsolete update (oxymoron?) m(_ _)m
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum