You are not logged in.
Didn't realize this was just worked on in a thread below, but here is my attempt at the colored pacman search. A few advantages besides being in color: if you have a local package that isn't in the sync directory, it will show up in the list; all packages installed are marked with a ***; each repo has its own color. It's pretty short and quick, but doesn't touch the AUR. I put it in /usr/bin as pacsearch, do what you please with it. Feel free to improve it or fix the TODO's I have left.
#!/bin/bash
#TODO: colors flag on commandline
readonly progname="pacsearch"
readonly BLUE='\e[0;34m'
readonly RED='\e[0;31m'
readonly GREEN='\e[0;32m'
readonly PURPLE='\e[0;35m'
readonly BROWN='\e[0;33m'
readonly CYAN='\e[0;36m'
readonly LRED='\e[1;31m'
readonly LCYAN='\e[1;36m'
readonly LGRAY='\e[0;37m'
readonly BASE='\e[0;37m'
if [ -z "$1" ]; then
echo "Usage: $progname <pattern>"
echo "Ex: $progname ^gnome"
exit 0
fi
# Make two temp files and send output of commands to these files
querydump=`mktemp`
pacman -Qs $1 > $querydump
syncdump=`mktemp`
pacman -Ss $1 > $syncdump
# Strip descriptions and 'local/' from -Qs query
instpkg=`mktemp`
egrep '^[^ ]' $querydump | sed -e 's@^local/@@' > $instpkg
# Add pkgs not in sync db, mark pkgs that are installed
cat $instpkg | while read -r pkg; do
if [ -z "`grep "$pkg" $syncdump`" ]; then
#TODO: only one line of descript is added, even if it is longer
grep -A 1 "$pkg" $querydump >> $syncdump
fi
sed -i "s@^(.+/$pkg)@***1@" $syncdump
done
# Print colorized package list and descriptions to screen
echo -e "$(sed -r
-e "s@current/.*@$BLUE&$BASE@"
-e "s@extra/.*@$GREEN&$BASE@"
-e "s@community/.*@$PURPLE&$BASE@"
-e "s@testing/.*@$CYAN&$BASE@"
-e "s@unstable/.*@$RED&$BASE@"
-e "s@custom/.*@$BROWN&$BASE@"
-e "s@local/.*@$LCYAN&$BASE@"
-e "s@(^|***)([[:alnum:]]*/.* .*)@1$CYAN2$BASE@"
-e "s@***@$LRED&@"
< $syncdump )"
echo -en "e[0m"
rm $querydump
rm $syncdump
rm $instpkg
Offline
Wonderful! I just found this and tried it out: it works perfectly!
Thank you!
Offline