1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

* -Qs was returning an error if no package found, which is not the same behavior as -Ss.

This commit is contained in:
Dan McGee 2007-03-06 22:06:28 +00:00
parent e6d6ee2c5a
commit 48181e9a84
2 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -92,7 +92,7 @@ int pacman_query(alpm_list_t *targets)
if(config->op_q_search) {
alpm_list_t *ret = alpm_db_search(db_local, targets);
if(ret == NULL) {
return(1);
return(0);
}
for(i = ret; i; i = alpm_list_next(i)) {
char *group = NULL;