diff options
author | Dan McGee <dan@archlinux.org> | 2007-03-06 22:06:28 +0000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-03-06 22:06:28 +0000 |
commit | 48181e9a84c84b698b7fdce859889d6c24849da3 (patch) | |
tree | 848297c07384707d4382376cfd187cde08965105 /contrib/pacsearch | |
parent | e6d6ee2c5a3f25004dc1b9688d07838e3c4b3138 (diff) |
* -Qs was returning an error if no package found, which is not the same behavior as -Ss.
Diffstat (limited to 'contrib/pacsearch')
-rwxr-xr-x | contrib/pacsearch | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/contrib/pacsearch b/contrib/pacsearch index 71d45287..63a74abd 100755 --- a/contrib/pacsearch +++ b/contrib/pacsearch @@ -20,6 +20,7 @@ #TODO: colors flag on commandline readonly progname="pacsearch" +readonly version="1.0" readonly CLR1='\\\e[0;34m' readonly CLR2='\\\e[0;32m' @@ -31,21 +32,36 @@ readonly CLR7='\\\e[1;36m' readonly INST='\\\e[1;31m' readonly BASE='\\\e[0m' -if [ -z "$1" ]; then +if [ "$1" = "--help" -o "$1" = "-h" ]; then echo "Usage: $progname <pattern>" echo "Ex: $progname ^gnome" exit 0 fi +if [ "$1" = "--version" -o "$1" = "-v" ]; then + echo "$progname version $version" + echo "Copyright (C) 2006-2007 Dan McGee" + exit 0 +fi + +if [ -z "$1" -o "${1:0:1}" = "-" ]; then + echo "Usage: $progname <pattern>" + echo "Ex: $progname ^gnome" + exit 1 +fi + +echo "debug 1" # Make two temp files and send output of commands to these files querydump=$(mktemp) pacman -Qs $1 > $querydump syncdump=$(mktemp) pacman -Ss $1 > $syncdump +echo "debug 2" # Strip descriptions and 'local/' from -Qs query instpkg=$(mktemp) egrep '^[^ ]' $querydump | sed -e 's@^local/@@' > $instpkg +echo "debug 3" # Add pkgs not in sync db, mark pkgs that are installed cat $instpkg | while read -r pkg; do @@ -57,6 +73,7 @@ cat $instpkg | while read -r pkg; do sed -i "s@^\(.\+/$pkg\)@\***\1@" $syncdump done +echo "debug 4" # Print colorized package list and descriptions to screen echo -e "$(sed -r \ -e "s@current/.*@$CLR1&$BASE@" \ @@ -71,6 +88,7 @@ echo -e "$(sed -r \ < $syncdump )" echo -en "\e[0m" +echo "debug 5" rm $querydump rm $syncdump rm $instpkg |