[pacman-dev] Pacman color output
Wael Nasreddine
wael at siemens-mobiles.org
Sun Jun 4 08:09:20 EDT 2006
VMiklos wrote:
> On Sun, Jun 04, 2006 at 01:39:50PM +0200, Wael Nasreddine <wael at siemens-mobiles.org> wrote:
>> I don't know if you have discussed this before, any chance to see
>> color support to pacman's output? i really loved the way pacman does
>> the download when adding "ilovecandy" to /etc/pacman.conf :D, so I
>
> if you have ilovecandy in pacman.conf, then why not? probably it should
> be disabled by default, it can cause problems on some weird terminals
>
Yes it is disabled by default actually and i didn't even know about it,
i just saw it inside the code..
>> tried to add some colors but since the string length is checked in
>> pm_fprintf function, it may break the message, I tried doing it in
>
> you mean the 9 chars limit?
>
> see this:
> http://www.archlinux.org/pipermail/pacman-dev/2006-May/000313.html
>
> if that's the problem, then just use the patch, and it'll go away :)
>
it is already applied, i'll see how many chars i can print
>> another way (by simply adding an extra char *color to pm_fprintf
>> function) but I am not a C++ programer so i failed specially about
>
> pacman is written in C, not in C++
>
:$
>> adding strings together (color + str + CLEAR) to fprintf, anyone
>> interresting in doing it ?
>
> the coding part, yes. but i don't want to figure out what colors looks
> nice :) ok, probably red for errors, but the others..
>
> example:
>
> $ LANG= LC_ALL= sudo pacman -Sy
> :: Synchronizing package databases...
>
> then you can say
>
> echo -e "\e[01;36m::\e[0m \e[01mSynchronizing package databases...\e[0m"
>
> would be nicer. that way you don't have to do any coding and i don't
> have to figure out the colors :)
>
Actually what i did, in src/pacman/log.h i added something like
/* colors */
#define GREEN "\033[1;32m"
#define RED "\033[1;31m"
#define YELLOW "\033[1;33m"
#define BLUE "\033[1;36m"
#define CLEAR "\033[m"
maybe add them in the config instead but anyway this would be make
things easier, i also added config->color (use_color directive) which
probably be better, though there's too much messages to edit, anyway
i'll try the above instead of GREEN etc.. i'll call them INFO WARN ERROR
CLEAR so it'll be open, and if it's ok i'll send a patch (base code is
urs from frugalware) ..
> udv / greetings,
> VMiklos
>
Regards,
Wael Nasreddine
More information about the pacman-dev
mailing list