You are not logged in.

#1 2005-05-17 21:28:16

citral
Member
Registered: 2005-05-07
Posts: 87

pacman with colored -Ss

The -Ss output compared to "some other distros"  is horrible.
I'm not dissing pacman here, but the readability could be improved! So I made a very simple hack to have  pacman output the descriptions in green when searching, which helps alot.

I figured someone else might like colored -Ss too, so here it goes:
PKGBUILD


One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.

Offline

#2 2005-05-17 23:55:02

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: pacman with colored -Ss

Uhh... Forgive me for being dense, but how does a colored -Ss output help you?

Offline

#3 2005-05-18 00:05:15

citral
Member
Registered: 2005-05-07
Posts: 87

Re: pacman with colored -Ss

How it helps me? It helps me actually find what I want from the -Ss output instead of getting a headache when trying to glance over the output.


One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.

Offline

#4 2005-05-18 03:26:29

dtw
Forum Fellow
From: UK
Registered: 2004-08-03
Posts: 4,439
Website

Re: pacman with colored -Ss

i guess it could be prettier - you can always file a feature request on the bug tracker but you'll have to put trivial on the importance....

Offline

#5 2005-05-18 04:35:15

Cam
Member
From: Brisbane, Aus
Registered: 2004-12-21
Posts: 658
Website

Re: pacman with colored -Ss

I agree, it's not life threatening but the readability is much better. I'm not really fussed either way though, I installed srcpac and was less than impressed no so pacman wrappers for me anymore wink

Offline

#6 2005-05-18 07:05:15

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: pacman with colored -Ss

citral wrote:

How it helps me? It helps me actually find what I want from the -Ss output instead of getting a headache when trying to glance over the output.

Are you tired to use grep?

"Pacman -Ss gnome | grep ogg" f.e. shall give you all gnome packages, that include "ogg" in its name or description.


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#7 2005-05-18 09:04:18

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: pacman with colored -Ss

Pink Chick wrote:
citral wrote:

How it helps me? It helps me actually find what I want from the -Ss output instead of getting a headache when trying to glance over the output.

Are you tired to use grep?

"Pacman -Ss gnome | grep ogg" f.e. shall give you all gnome packages, that include "ogg" in its name or description.

But grep doesnt really work that well.

If the program has the word in its description and not in its name, you only get the description, which may as well be french when its not linked to the name of the program

iphitus

Offline

#8 2005-05-18 15:44:23

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: pacman with colored -Ss

... shocked, right you are ...


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#9 2005-05-18 15:58:10

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman with colored -Ss

Well, according to dibble, I'm of "the camp that believes anything scriptable in less than 10 lines shouldn't be a feature" (heh), so take this with a grain of salt...

it wouldn't be hard at all to make a little filter (note: this is the *nix philosophy) that colorizes the output... something like [pacman -Ss foo | pac-color]

hell, it's even less work using something like csed from http://colorifer.sourceforge.net/

Offline

#10 2005-05-18 16:59:19

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: pacman with colored -Ss

iphitus wrote:
Pink Chick wrote:

Are you tired to use grep?

"Pacman -Ss gnome | grep ogg" f.e. shall give you all gnome packages, that include "ogg" in its name or description.

But grep doesnt really work that well.

If the program has the word in its description and not in its name, you only get the description, which may as well be french when its not linked to the name of the program

iphitus

$ pacman -Ss "something" | grep "/" | grep "something"

will give programs containing "something" in their names

I wouldn't mind some coloured output. Piping the output through something to colorize it is... a nice idea.. from a dev's point of view. Not sure how thrilled the normal users would be.

Offline

#11 2005-05-18 17:00:15

citral
Member
Registered: 2005-05-07
Posts: 87

Re: pacman with colored -Ss

Sure, I could've mangled the output of -Ss. I was just under the impression that I wasn't the only one annoyed by the hard to read output.


One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.

Offline

#12 2005-05-18 17:32:09

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: pacman with colored -Ss

Let's talk about colors then. I'd prefer pink, of course.


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#13 2005-05-18 17:41:28

slackhack
Member
Registered: 2004-06-30
Posts: 738

Re: pacman with colored -Ss

anything that increases readability (and therefore usability) should be encouraged and embraced, imo. especially if it's something that's easy to implement. big_smile

Offline

#14 2005-05-18 17:51:03

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: pacman with colored -Ss

As far as I can remember, some users already provided some patches to colorize pacman...

Offline

#15 2005-05-18 19:32:49

Vinny
Member
From: the fifth floor
Registered: 2005-04-25
Posts: 29

Re: pacman with colored -Ss

This seems to work.

echo -e "$(pacman -Ss gtk2 
| sed s/custom\/.*/\\033[0;33m&\\033[0;37m/g 
| sed s/current\/.*/\\033[0;31m&\\033[0;37m/g 
| sed s/extra\/.*/\\033[0;32m&\\033[0;37m/g 
| sed s/community\/.*/\\033[0;35m&\\033[0;37m/g)"

;-)

Offline

#16 2005-05-18 19:45:49

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman with colored -Ss

Vinny wrote:

This seems to work.

echo -e "$(pacman -Ss gtk2 | sed s/custom\/.*/\\033[0;33m&\\033[0;37m/g                                   
| sed s/current\/.*/\\033[0;31m&\\033[0;37m/g                                                             
| sed s/extra\/.*/\\033[0;32m&\\033[0;37m/g 
| sed s/community\/.*/\\033[0;35m&\\033[0;37m/g)"                                                          

;-)

nice... now to extend it...

#!/bin/bash
# filename: pacsearch

echo -e "$(pacman -Ss $@ | sed
s/custom\/.*/\\033[0;33m&\\033[0;37m/g                                   
| sed s/current\/.*/\\033[0;31m&\\033[0;37m/g                                                             
| sed s/extra\/.*/\\033[0;32m&\\033[0;37m/g 
| sed s/community\/.*/\\033[0;35m&\\033[0;37m/g)

then chmod +x it and run "pacsearch gtk" - bam

Offline

#17 2005-05-19 19:13:42

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,488

Re: pacman with colored -Ss

Impressive. A mass of \\\////and *****033 ... does fine art smile


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#18 2005-05-27 08:16:23

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: pacman with colored -Ss

I think this is great. Even though it's not vital to have colored output, it does make it easier to read, as well as looking better. A design whore like myself appreciates this kind of stuff!

It's also better to have colors because it's faster to recognize whatever packages you want without using grep. IMHO.

Offline

#19 2005-05-27 09:32:03

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: pacman with colored -Ss

phrakture: a tip with sed, you dont have to use s/blah/boo/ you can use other identifiers such as s@blah@boo@ so that you dont have to escape every slash. Also makes it slightly tidier and more readable than escaping everything.

Offline

#20 2005-05-27 15:57:37

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: pacman with colored -Ss

iphitus wrote:

phrakture: a tip with sed, you dont have to use s/blah/boo/ you can use other identifiers such as s@blah@boo@ so that you dont have to escape every slash. Also makes it slightly tidier and more readable than escaping everything.

yeah, I know - but it wasn't my sed script...Vinny wrote it and I just made it accept arguments...

Offline

#21 2005-05-27 16:58:57

Vinny
Member
From: the fifth floor
Registered: 2005-04-25
Posts: 29

Re: pacman with colored -Ss

I like / because I don't need to press SHIFT smile

Offline

#22 2005-07-02 14:28:45

citral
Member
Registered: 2005-05-07
Posts: 87

Re: pacman with colored -Ss

The scripts posted above are nice, but they don't color repos that you don't predefine. This fixes that FWIW.

In my .bashrc I have:

alias pacs="pacsearch"
pacsearch () {
         echo -e "$(pacman -Ss $@ | sed 
        -e 's#current/.*#\033[0;31m&\033[0;37m#g' 
        -e 's#extra/.*#\033[0;32m&\033[0;37m#g' 
        -e 's#community/.*#\033[0;35m&\033[0;37m#g' 
        -e 's#^.*/.* .*#\033[0;36m&\033[0;37m#g' )"
}

One of the main causes of the fall of the Roman Empire was that, lacking zero,
they had no way to indicate successful termination of their C programs.

Offline

#23 2005-07-02 17:03:30

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: pacman with colored -Ss

good script for wiki, once you guys finish hacking each other's work. Actually, maybe the wiki would be a good place to hack it.

I love tihs idea. We have colour initscripts, what's wrong with colour pacman!?

Dusty

Offline

#24 2005-07-05 08:09:51

deficite
Member
From: Augusta, GA
Registered: 2005-06-02
Posts: 693

Re: pacman with colored -Ss

Not to mention makepkg already has color

Offline

#25 2005-07-11 21:14:07

noamsml
Member
Registered: 2005-06-25
Posts: 42
Website

Re: pacman with colored -Ss

Vinny wrote:

This seems to work.

echo -e "$(pacman -Ss gtk2 
| sed s/custom\/.*/\\033[0;33m&\\033[0;37m/g 
| sed s/current\/.*/\\033[0;31m&\\033[0;37m/g 
| sed s/extra\/.*/\\033[0;32m&\\033[0;37m/g 
| sed s/community\/.*/\\033[0;35m&\\033[0;37m/g)"

;-)

small fix:

echo -e "$(pacman -Ss gtk2 
| sed s/custom\/.*/\\033[0;33m&\\033[0;37m/g 
| sed s/current\/.*/\\033[0;31m&\\033[0;37m/g 
| sed s/extra\/.*/\\033[0;32m&\\033[0;37m/g 
| sed s/community\/.*/\\033[0;35m&\\033[0;37m/g)e[m"

there, that's better.


I summon daemons from the depths of /etc/rc.d

Offline

Board footer

Powered by FluxBB