summaryrefslogtreecommitdiffstats
path: root/watch-bz
diff options
context:
space:
mode:
Diffstat (limited to 'watch-bz')
-rwxr-xr-xwatch-bz18
1 files changed, 14 insertions, 4 deletions
diff --git a/watch-bz b/watch-bz
index c118d71..a2eae5f 100755
--- a/watch-bz
+++ b/watch-bz
@@ -32,6 +32,18 @@ BZPASSWORD=
# user configuration
[ -f ~/.watchbzrc ] && source ~/.watchbzrc
+# Fedora and color-friendly watch: rhbz#801626
+WATCHCMD=watch
+COLORIZE=cat
+if watch --color -n0.1 -g date &>/dev/null; then
+ WATCHCMD='watch --color'
+ COLORIZE="sed"
+ COLORIZE+=" -e 's|\([0-9.A-Z]\++[, ]\)|\x1b[1;32m\1\x1b[0m|g'"
+ COLORIZE+=" -e 's|\([0-9.A-Z]\+-[, ]\)|\x1b[35m\1\x1b[0m|g'"
+ COLORIZE+=" -e 's|\([0-9.A-Z]\+?[, ]\)|\x1b[37m\1\x1b[0m|g'"
+ COLORIZE+=" -e 's|\(!!!\)|\x1b[1;31m\1\x1b[0m|g'"
+fi
+
# guess correct paths
if [ -z "$BUGZILLA" ] || [ -n "${BUGZILLA_ROOT}" ]; then
# BUGZILLA_ROOT (path to local repo) should rather be set in ~/.watchbzrc
@@ -86,7 +98,7 @@ do_init () {
# exclusively using globals
do_watch () {
#sh -c \
- watch -t --interval $REFRESH_INTERVAL --differences=cumulative \
+ ${WATCHCMD} -t --interval $REFRESH_INTERVAL --differences=cumulative \
"$BUGZILLA --cookiefile="${BUGZILLA_COOKIE}" query -c $COMPONENT \
-t $STATUS --outputformat $OUTPUT_FMT \
| sed -u \
@@ -117,9 +129,7 @@ do_watch () {
-e \"s|rhel-||g\" \
-e \"s|qe_test_coverage||\" \
-e \"s|None||\" \
- | ${HERE}/table-data $SEP | sort | cut -c-$WIDTH"
- # todo: colours for priorities (rhbz#801626)
- #-e 's/\(urgent\)/\^\[\[31m\1\^\[\[0m/' \
+ | ${HERE}/table-data $SEP | sort | cut -c-$WIDTH | ${COLORIZE}"
}
do_init