You are not logged in.

#1 2017-09-04 10:39:34

unnilquadium
Member
Registered: 2017-08-27
Posts: 86

[SOLVED] pacman Post transaction hooks with color

Hello.

I've created a post transaction hook to clear the pacman cache using the paccache script as suggested here: https://wiki.archlinux.org/index.php/pa … kage_cache

When using the script directly it returns messages with color.
Is there anyway to keep the colored output when the script is used in a hook?

Thanks.

Last edited by unnilquadium (2017-09-04 13:16:30)

Offline

#2 2017-09-04 10:53:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,545
Website

Re: [SOLVED] pacman Post transaction hooks with color

see --color in `man pacman`.

EDIT: oops, the section you linked to first had pacman commands, but you said you are using paccache - that likely has similar flags - (edit2) or maybe not.  It seems this is hardcoded into the script starting on line 475.  But it is just a script, you could readily edit that block (from 475-493).

Last edited by Trilby (2017-09-04 10:56:47)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2017-09-04 13:13:55

unnilquadium
Member
Registered: 2017-08-27
Posts: 86

Re: [SOLVED] pacman Post transaction hooks with color

ok, it worked by editing that section and leaving it like this:

unset ALL_OFF BOLD BLUE GREEN RED YELLOW

ALL_OFF="$(tput sgr0)"
BOLD="$(tput bold)"
BLUE="${BOLD}$(tput setaf 4)"
GREEN="${BOLD}$(tput setaf 2)"
RED="${BOLD}$(tput setaf 1)"
YELLOW="${BOLD}$(tput setaf 3)"

readonly ALL_OFF BOLD BLUE GREEN RED YELLOW

Thanks

Offline

#4 2017-09-04 16:58:00

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] pacman Post transaction hooks with color

You can always submit a patch to pacman-contrib to accept --color=[always|auto|never] or similar. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB