As you may know, I hate using web apps because (greasemonkey aside) they
aren't user-programmable. Having used debbugs and request tracker, I
have come to expect the ability to manipulate trackers directly from my
desktop, without needing to fire up a web browser. This functionality
is not provided by roundup, so over the last fortnight I've spent some
time hacking on a basic CLI to implements a few workflows.
#!/bin/bash
set -eE
f=$(mktemp -t ru.XXXXXX)
trap "rm -f \"$f\"" 0 TERM INT QUIT
RU_VERSION=0.0.0
: ${ROUNDUP_WWW:=http://bugs.darcs.net}
: ${ROUNDUP_MAIL:[EMAIL PROTECTED]
: ${ROUNDUP_USER:=$USER}
mail () {
printf %s\\n "To: $ROUNDUP_MAIL" "X-RU-Version: $RU_VERSION" "$@" |
/usr/sbin/sendmail -oi -t
}
asxml () {
curl -s $ROUNDUP_WWW/$1 |
# Turn it into valid XML
tidy -asxml --numeric-entities yes --doctype strict 2>/dev/null |
# Kludge to make all elements "local", i.e. without a
# namepace. This means I can do "sel -N html=... -m
# /html:html" I can just do "sel -m /html".
sed 's|xmlns="http://www.w3.org/1999/xhtml"||'
}
case $1 in
show)
if [[ -m = $2 ]]
then
curl >$f http://bugs.darcs.net/[EMAIL PROTECTED] && mutt -f $f
# asxml issue$3 |
# xmlstarlet sel -T -t -m "//[EMAIL PROTECTED]'messages']/tr/th/a" -v @href -n |
# while read msg
# do
# asxml $msg >$f
# # create a fake envelope from as mbox(5) expects.
# echo "From [EMAIL PROTECTED] Fri Jun 23 02:56:55 2000"
# # extract the headers
# <$f xmlstarlet sel -T -t -m "//[EMAIL PROTECTED]'form']/tr" -c th -o ': ' -c td -n |
# while read x y
# do
# case $x in
# Issue:) echo "Subject: $y";;
# Author:) echo "From: $y";;
# Recipients:) echo "To: $y";;
# Date:) echo "Date: $(date -d "${y//./T}" -R)";;
# *) echo "$x $y";;
# esac
# done
# echo
# <$f xmlstarlet sel -T -t -m "//[EMAIL PROTECTED]'history']/tr" -c "td[position()=3]" -o ' ' -c "td[position()=4]" -n
# echo "thank you" # I wanna be like debbugs.
# echo
# <$f xmlstarlet sel -T -t -m "//[EMAIL PROTECTED]'messages']//pre" -c .
# echo
# done
else
${BROWSER:-sensible-browser} $ROUNDUP_WWW/issue$2
fi
;;
retitle) mail "Subject: [issue$2] $3";;
subscribe) mail "Subject: [issue$2] [nosy=+$ROUNDUP_USER]";;
unsubscribe) mail "Subject: [issue$2] [nosy=-$ROUNDUP_USER]";;
status) mail "Subject: [issue$2] [status=$3]";;
*) echo >&2 "Unrecognized command \`$1\'."; exit 1;;
esac
This allows you to do things like "ru show 33" to fire up a browser on
issue 33, or "map ru subscribe -- 33 194 55" to add yourself to the nosy
list of three tasks at once.
You'll notice a large block has been commented out; it was responsible
for web scraping a task's issues and generating an mbox. This has been
mostly implemented on the server side now thanks to Simon Michael. Now
you can do
ru show -m 33
To view a threaded archive of comments made to a roundup issue.
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users