contrib/paclog-pkglist: whitespace cleanup

add a modeline and change 2 space indent to a tab.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-07-18 10:33:45 -04:00 committed by Dan McGee
parent 3294039a00
commit 3934a842b8

View file

@ -22,47 +22,47 @@ export TEXTDOMAINDIR='/usr/share/locale'
declare logfile=${1:-@localstatedir@/log/pacman.log} declare logfile=${1:-@localstatedir@/log/pacman.log}
if [[ $1 ]]; then if [[ $1 ]]; then
if [[ $1 = -@(h|-help) ]]; then if [[ $1 = -@(h|-help) ]]; then
printf 'usage: %s [pacman log]\n' "${0##*/}" printf 'usage: %s [pacman log]\n' "${0##*/}"
printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}" printf 'example: %s @localstatedir@/log/pacman.log\n' "${0##*/}"
printf '\ndefaults to: @localstatedir@/log/pacman.log\n' printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
exit 0 exit 0
elif [[ ! -e $logfile ]]; then elif [[ ! -e $logfile ]]; then
printf $"target not found: %s\n" "$1" printf $"target not found: %s\n" "$1"
exit 1 exit 1
fi fi
fi fi
<"$logfile" awk ' <"$logfile" awk '
{ {
action = $3 action = $3
pkgname = $4 pkgname = $4
pkgver = $5 pkgver = $5
upgver = $7 upgver = $7
} }
NF == 5 && action == "installed" { NF == 5 && action == "installed" {
gsub(/[()]/, "", pkgver) gsub(/[()]/, "", pkgver)
pkg[pkgname] = pkgver pkg[pkgname] = pkgver
next next
} }
NF == 7 && action == "upgraded" { NF == 7 && action == "upgraded" {
sub(/\)/, "", upgver) sub(/\)/, "", upgver)
pkg[pkgname] = upgver pkg[pkgname] = upgver
next next
} }
NF == 5 && action == "removed" { NF == 5 && action == "removed" {
pkg[pkgname] = -1 pkg[pkgname] = -1
} }
END { END {
for (i in pkg) { for (i in pkg) {
if (pkg[i] != -1) { if (pkg[i] != -1) {
printf "%s %s\n",i,pkg[i] printf "%s %s\n",i,pkg[i]
} }
} }
}' | sort }' | sort
# vim: set ts=2 sw=2 noet: # vim: set ts=2 sw=2 noet: