[pacman-dev] Colour support in pacman!

Dave Reisner d at falconindy.com
Tue Mar 5 10:31:21 EST 2013


On Tue, Mar 05, 2013 at 04:19:13PM +0100, Christian Hesse wrote:
> Simon Gomizelj <simongmzlj at gmail.com> on Mon, 2013/03/04 17:49:
> > I believe I addressed all the criticisms thus far.
> > 
> > I'll just share this instead of spamming the mailing list with yet
> > another patchset.
> > 
> > https://github.com/vodik/pacman/compare/5770425...master
> 
> Tested your patches, works really well so far.
> 
> I would like pacman to color the actions it performs. Messages printed by
> pre_*() and post_*() functions would be a lot more visible then.
> 
> The attached patch is just a "quick and dirty proof of concept.

I'm not really in favor of doing this. We're already labelling output in
the log file which makes it stand out quite well on its own. I don't
think we need to do this as well on terminal output.

Example:

[2013-03-04 16:50] [PACMAN] Running 'pacman -Su'
[2013-03-04 16:50] [PACMAN] starting full system upgrade
[2013-03-04 16:51] [PACMAN] upgraded libldap (2.4.33-3 -> 2.4.34-1)
[2013-03-04 16:51] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2013-03-04 16:51] [ALPM-SCRIPTLET] >>> Generating initial ramdisk, using mkinitcpio.  Please wait...
[2013-03-04 16:51] [ALPM-SCRIPTLET] ==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
[2013-03-04 16:51] [ALPM-SCRIPTLET]   -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
[2013-03-04 16:51] [ALPM-SCRIPTLET] ==> Starting build: 3.8.2-1-ARCH
[2013-03-04 16:51] [ALPM-SCRIPTLET]   -> Running build hook: [base]
[2013-03-04 16:51] [ALPM-SCRIPTLET]   -> Running build hook: [timestamp]
[2013-03-04 16:51] [ALPM-SCRIPTLET]   -> Running build hook: [strip]
[2013-03-04 16:51] [ALPM-SCRIPTLET]   -> Running build hook: [shutdown]
[2013-03-04 16:51] [ALPM-SCRIPTLET] ==> Generating module dependencies
[2013-03-04 16:51] [ALPM-SCRIPTLET] ==> Creating cat initcpio image: /boot/initramfs-linux.img
[2013-03-04 16:51] [ALPM-SCRIPTLET] ==> Image generation successful
[2013-03-04 16:51] [PACMAN] upgraded linux (3.8.1-1 -> 3.8.2-1)
[2013-03-04 16:51] [PACMAN] upgraded linux-headers (3.8.1-1 -> 3.8.2-1)

> -- 
> main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
> "CX:;",b;for(a/*    Chris           get my mail address:    */=0;b=c[a++];)
> putchar(b-1/(/*               gcc -o sig sig.c && ./sig    */b/42*2-3)*42);}

> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> index d0887cb..468ea38 100644
> --- a/src/pacman/callback.c
> +++ b/src/pacman/callback.c
> @@ -517,8 +517,9 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
>  
>  	}
>  
> -	printf("(%*ld/%*ld) %ls%-*s", digits, (unsigned long)current,
> -			digits, (unsigned long)howmany, wcstr, padwid, "");
> +	const colstr_t *colstr = &config->colstr;
> +	printf("(%*ld/%*ld) %s%ls%s%-*s", digits, (unsigned long)current,
> +			digits, (unsigned long)howmany, colstr->title, wcstr, colstr->nc, padwid, "");
>  
>  	free(wcstr);
>  




> 



More information about the pacman-dev mailing list