summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-05-21 23:36:44 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-05-21 23:36:44 +0200
commit0573c4cd518bc1928c3a8b941692fedb25600368 (patch)
tree84476bf67417b69b75024997b02c099f7d2d9cb3
parent6e2fcddfeb63a8e81bfd9c9c2043d191bbd87209 (diff)
downloadwatch-bz-0573c4cd518bc1928c3a8b941692fedb25600368.tar.gz
watch-bz-0573c4cd518bc1928c3a8b941692fedb25600368.tar.xz
watch-bz-0573c4cd518bc1928c3a8b941692fedb25600368.zip
Add support for WATCHBZ_DEBUG option/env. var
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rwxr-xr-xwatch-bz11
1 files changed, 7 insertions, 4 deletions
diff --git a/watch-bz b/watch-bz
index 57a4a7a..920a5f2 100755
--- a/watch-bz
+++ b/watch-bz
@@ -29,6 +29,7 @@ BUGZILLA_COOKIE=~/.watchbzcookies
BUGZILLA_LOGOUT=1
# example defaults, modify via ~/.watchbzrc
+: ${WATCHBZ_DEBUG:=0}
COMPONENT=acpid,mc
STATUS=OPEN
REFRESH_INTERVAL=600 # [s], better not to drain bugzilla's power...
@@ -144,8 +145,11 @@ do_init () {
# exclusively using globals
do_watch () {
- #sh -c \
- ${WATCHCMD} -t --interval $REFRESH_INTERVAL \
+ EXEC="${WATCHCMD} -t --interval $REFRESH_INTERVAL"
+ [ "${WATCHBZ_DEBUG}" -ne 0 ] && EXEC="sh -c"
+ TAIL="${HERE}/table-data $SEP | sort | ${PRECOLORIZE} | cut -c-$WIDTH | ${COLORIZE}"
+ [ "${WATCHBZ_DEBUG}" -ne 0 ] && TAIL="cat"
+ ${EXEC} \
"$BUGZILLA --cookiefile="${BUGZILLA_COOKIE}" query -c $COMPONENT \
-t $STATUS --outputformat $OUTPUT_FMT \
| sed -u \
@@ -175,8 +179,7 @@ do_watch () {
-e \"s|docs_scoped|DS|\" \
-e \"s|rhel-||g\" \
-e \"s|qe_test_coverage[?+-][,]\?||\" \
- -e \"s|None||\" \
- | ${HERE}/table-data $SEP | sort | ${PRECOLORIZE} | cut -c-$WIDTH | ${COLORIZE}"
+ -e \"s|None||\" | ${TAIL}"
}
do_init