Created
December 6, 2011 07:48
-
-
Save rkumar/1437244 to your computer and use it in GitHub Desktop.
quickly print last 10 bugs from bugzy.sqlite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# quickly report data from sqldatabase avoiding ruby's load time | |
# also colorize file | |
# colorize can only do a line, whereas sed allows us to do parts. but using ansi | |
# its not easy to do both lines and part, so it sucks | |
# most allows us to page horizontally | |
# less does not | |
# colorize only does basic colors, in bash we can do 256. | |
# http://cbouvi.free.fr/download/colorize/colorize-0.5.tar.gz | |
# http://code.google.com/p/ansi-color/ | |
out=~/tmp/tmp.tmp | |
trap "rm -f $out ./colorize.cfg; exit 1" 0 1 2 3 13 15 | |
cd /Users/rahul/work/projects/rbcurse/examples | |
# next line uses 'color' http://code.google.com/p/ansi-color/ | |
echo "$(color white red)Showing last 10 tasks $(color off)" | |
echo " ---------------- " | |
sqlite3 bugzy.sqlite "select id, status, priority, title from bugs where status != 'closed' order by id desc limit 10;" | sed 's/|/ | /g' > $out | |
cat <<ZZZ > ./colorize.cfg | |
/cancel/ black | |
/closed/ black | |
/started/ blue on_yellow | |
/P1/ reverse | |
/P2/ bold white on_blue | |
/P3/ yellow | |
/P4/ magenta | |
/P5/ bold blue | |
ZZZ | |
colorize --config=./colorize.cfg $out | |
rm -f ./colorize.cfg $out | |
trap 0 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment