Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 47 lines (36 sloc) 1.179 kB
#!/bin/bash
#
# retreive aur comments for a package
# - package name can be specified or pulled from a PKGBUILD in $PWD
# - specify -a to show all comments
#
AURURL="http://aur.archlinux.org"
ALL='&comments=all'
printf -v CON '\e[1;34m'
printf -v COFF '\e[0m'
commfilter() {
xmllint --html --xpath \
'//div[@class="pgbox"]/div[@class="comment-header"]/..' - 2>/dev/null |
sed 's/<[^>]\+>//g;s/\t//g;s/\r$//
/Comment by:/,/[[:alnum:]]\+/{/^$/d};
s/&gt;/>/g;s/&lt;/</g;
s/^\(Comment by:.*\)$/'"$CON"'\1'"$COFF"'/'
# line 1: strip html tags, remove tabs and ^M
# line 2: strip empty lines between timestamp and body
# line 3: decode HTML
# line 4: add color
}
[[ $1 = -a ]] && { showall=$ALL; shift; }
if ! (( $# )); then
if [[ ! -f PKGBUILD ]]; then
printf "error: no PKGBUILD found and no package name provided!\n"
exit 1
fi
eval $(grep '^pkgname=' PKGBUILD)
fi
pkgname=${1:-$pkgname}
if ! pkgID=$(cower -i --format '%i' "$pkgname" 2>/dev/null); then
printf "error: package \`%s' not found\n" "$pkgname"
exit 1
fi
curl -s "$AURURL/packages.php?ID=$pkgID$showall" | commfilter | fmt -sw$(tput cols)
Jump to Line
Something went wrong with that request. Please try again.