On 06/08/10 19:40, Simon Stoakley wrote:
On 06/08/10 06:33, Dave Reisner wrote:
Hi.
Let's see what we can do about cutting back a little on the verbosity,
and upping the utility...
-------------------------
#!/bin/bash
pkg=()
desc=()
count=-1
Snip....
----
Been messing around with this a little, added pacman -Qs option, single
space option (-d default) and some colours. Wrapped it in a function so
can call it pacside [-qs] schstring.
Thought I'd put it back up in case anyone's interested.
pacside() {
sidesch() {
bldblu='\e[1;34m' # Blue
bldwht='\e[1;37m' # White
txtrst='\e[0m' # Text Reset
pkg=()
desc=()
count=-1
WIDTH=${WIDTH:-70}
while read line; do
if [[ $line =~
^(testing|core|extra|community|community-testing|local)/* ]]; then
(( count++ ))
line="$(echo $line | echo $line |cut -d "[" -f1 )"
pkg[$count]="$line"
continue
fi
desc[$count]+="$line"
done
i=0
while (( i <= $count )); do
IFS=$'\n' read -r -d'\0' -a blockdesc < <(fmt -w$WIDTH <<<
"${desc[i]}")
paste -d' ' <(printf "${bldblu}\t%-60s" "${pkg[i]}") <(echo
-e "${bldwht}${blockdesc[0]}${txtrst}")
for line in "${blockdesc[@]:1}"; do
printf "${bldwht}\t%-61s%s\n" "" "$line"
done
(( ++i ))
[[ $1 != -s ]] && echo
done
}
[[ -z $2 ]] && pacman -Ss $1 | sidesch
[[ $1 == -s ]] && pacman -Ss $2 | sidesch -s
[[ $1 == -q ]] && pacman -Qs $2 | sidesch
[[ $1 == -sq ]] || [[ $1 == -qs ]] && pacman -Qs $2 | sidesch -s
}
--