[pacman-dev] [PATCH] pacsearch colors and variable names

Pierre Neidhardt ambrevar at gmail.com
Wed Jan 8 18:54:43 EST 2014


On 14-01-08 18:14:05, Jason St. John wrote:
> On Wed, Jan 8, 2014 at 12:23 PM, Pierre Neidhardt <ambrevar at gmail.com> wrote:
> > [...]
> > +# Color a "repo/pkgname pkgver (goups) [installed]" line.
> > +# We try to stick to pacman colors.
> >  sub to_color {
> >         my $line = shift;
> > -       # get the installed text colored first
> > -       $line =~ s/(\[.*\]$)/$INST$1$BASE/;
> > -       # and now the repo and dealings
> > -       $line =~ s/(^core\/.*)/$CLR1$1$BASE/;
> > -       $line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
> > -       $line =~ s/(^community\/.*)/$CLR3$1$BASE/;
> > -       $line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
> > -       $line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
> > -       $line =~ s/(^multilib\/.*)/$CLR6$1$BASE/;
> > -       $line =~ s/(^local\/.*)/$CLR7$1$BASE/;
> > +       # get the installed text colored first (between square brackets)
> > +       $line =~ s/(\[.*\]$)/$FMT_CYAN$1$FMT_RESET/;
> > +    # group (between parentheses)
> > +    $line =~ s/(\(.*\))/$FMT_BLUE$1$FMT_RESET/;
> > +    # version (second field)
> > +    $line =~ s/^([^ ]+) ([^ ]+) /$1 $FMT_GREEN$2$FMT_RESET /;
> > +    # name (word after slash)
> > +    $line =~ s/\/([\w-]*)/\/$FMT_BOLD$1$FMT_RESET/;
> 
> You have mixed tabs and spaces in the above block.

Sorry for that. Need another patch?

> > +       # repo (word before slash inclusive)
> > +       $line =~ s/(^core\/)/$FMT_BLUE$1$FMT_RESET/;
> > +       $line =~ s/(^extra\/)/$FMT_GREEN$1$FMT_RESET/;
> > +       $line =~ s/(^community\/)/$FMT_MAGENTA$1$FMT_RESET/;
> > +       $line =~ s/(^testing\/)/$FMT_CYAN$1$FMT_RESET/;
> > +       $line =~ s/(^community-testing\/)/$FMT_RED$1$FMT_RESET/;
> > +       $line =~ s/(^multilib\/)/$FMT_YELLOW$1$FMT_RESET/;
> > +       $line =~ s/(^local\/)/$FMT_CYAN$1$FMT_RESET/;
> 
> I decided to compare the output of 'pacman -Ss vim' with 'pacsearch
> vim', and I found the output of pacsearch to be quite
> jarring---notably the use of a single color for the entire
> "repo/package version (group)" line. This isn't because of your patch
> because I'm using the version that's in the Arch repos now, but it's
> something we might want to look into after your patch gets applied.
> 
> Jason

I'm not sure I got you right on this, because this is exactly the purpose of my
patch: to get pacman and pacsearch coloring scheme on par. The only difference
being the repo's color, a pacsearch specific feature which I decided to keep. As
it has been discussed before, it should be less Arch specific and color any
active repos in a consistent manner, whatever their name may be.

-- 
Pierre Neidhardt

The only difference in the game of love over the last few thousand years
is that they've changed trumps from clubs to diamonds.
		-- The Indianapolis Star


More information about the pacman-dev mailing list