summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-10-31 23:35:48 +0100
committerJan Pokorný <jpokorny@redhat.com>2013-10-31 23:35:48 +0100
commit70af25b2464515036b1d260d22a9eed45d89f776 (patch)
tree95560032edd56f444d49380fddb27b83e3d92d3e
parentb16c7690879277f9fbcbb04e4672d06f804d3715 (diff)
downloadwatch-bz-feature-offset-move.tar.gz
watch-bz-feature-offset-move.tar.xz
watch-bz-feature-offset-move.zip
Start working towards convenient "scrolling"feature-offset-move
Known issue: missing wait or something prevents from convenient one-off ^C exit Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rwxr-xr-xwatch-bz93
1 files changed, 57 insertions, 36 deletions
diff --git a/watch-bz b/watch-bz
index 0ba33f9..207edaf 100755
--- a/watch-bz
+++ b/watch-bz
@@ -125,6 +125,8 @@ fi
do_logout () {
+ stty echo
+ kill $! 2>/dev/null
test -n "${BZUSER}" \
&& rm "${BUGZILLA_COOKIE}" \
&& echo "watch-bz: Authorization cookie removed"
@@ -184,6 +186,7 @@ do_init () {
# exclusively using globals
do_watch () {
+ local readstatus char move=0 newmove=0
EXEC="${WATCHCMD} -t --interval $REFRESH_INTERVAL"
[ "${WATCHBZ_DEBUG}" -ne 0 ] && EXEC="sh -c"
TAIL="${HERE}/table-data $SEP | sort -n | ${PRECOLORIZE} | cut -c-$WIDTH | ${COLORIZE}"
@@ -193,42 +196,60 @@ do_watch () {
[ "${WATCHBZ_DEBUG}" -ne 0 ] && echo \
"${BUGZILLA} --cookiefile=${BUGZILLA_COOKIE} query -c ${COMPONENT} \
-t \"${STATUS}\" --outputformat ${OUTPUT_FMT} ${QUERY_REST}"
- ${EXEC} \
- "${BUGZILLA} --cookiefile=${BUGZILLA_COOKIE} query -c ${COMPONENT} \
- -t \"${STATUS}\" --outputformat ${OUTPUT_FMT} ${QUERY_REST} \
- | sed -u \
- -e \"s|${SEP}Red Hat Enterprise Linux |${SEP}EL|\" \
- -e \"s|${SEP}Fedora|${SEP} F |\" \
- -e \"s|${SEP}NEW|${SEP}N|\" \
- -e \"s|${SEP}ASSIGNED|${SEP}A|\" \
- -e \"s|${SEP}POST|${SEP}P|\" \
- -e \"s|${SEP}MODIFIED|${SEP}M|\" \
- -e \"s|${SEP}ON_QA|${SEP}Q|\" \
- -e \"s|${SEP}ON_DEV|${SEP}D|\" \
- -e \"s|${SEP}VERIFIED|${SEP}V|\" \
- -e \"s|${SEP}RELEASE_PENDING|${SEP}R|\" \
- -e \"s|${SEP}CLOSED|${SEP}C|\" \
- -e \"s|${SEP}urgent|${SEP}!!!|\" \
- -e \"s|${SEP}high|${SEP}!!|\" \
- -e \"s|${SEP}medium|${SEP} ! |\" \
- -e \"s|${SEP}low|${SEP} ~ |\" \
- -e \"s|${SEP}unspecified|${SEP} ? |\" \
- -e \"s|qa_ack|QA|\" \
- -e \"s|pm_ack|PM|\" \
- -e \"s|devel_ack|DE|\" \
- -e \"s|needinfo|I|\" \
- -e \"s|exception|E|\" \
- -e \"s|blocker|BL|\" \
- -e \"s|requires_release_note|RN|\" \
- -e \"s|requires_doc_text|RD|\" \
- -e \"s|docs_scoped|D|g\" \
- -e \":dsloop\" \
- -e \"s|\([^A-Z]D-\+\),D-|\1-|g;tdsloop\" \
- -e \"s|\([^A-Z]D+\+\),D+|\1+|g;tdsloop\" \
- -e \"s|\([^A-Z]D?\+\),D?|\1?|g;tdsloop\" \
- -e \"s|rhel-||g\" \
- -e \"s|qe_test_coverage[?+-][,]\?||\" \
- -e \"s|None||\" | ${TAIL}"
+ while true; do
+ let move+=${newmove}
+ test "${move}" -ge 0 || move=0
+ newmove=0
+ ${EXEC} \
+ "${BUGZILLA} --cookiefile=${BUGZILLA_COOKIE} query -c ${COMPONENT} \
+ -t \"${STATUS}\" --outputformat ${OUTPUT_FMT} ${QUERY_REST} \
+ | sed -u \
+ -e \"s|${SEP}Red Hat Enterprise Linux |${SEP}EL|\" \
+ -e \"s|${SEP}Fedora|${SEP} F |\" \
+ -e \"s|${SEP}NEW|${SEP}N|\" \
+ -e \"s|${SEP}ASSIGNED|${SEP}A|\" \
+ -e \"s|${SEP}POST|${SEP}P|\" \
+ -e \"s|${SEP}MODIFIED|${SEP}M|\" \
+ -e \"s|${SEP}ON_QA|${SEP}Q|\" \
+ -e \"s|${SEP}ON_DEV|${SEP}D|\" \
+ -e \"s|${SEP}VERIFIED|${SEP}V|\" \
+ -e \"s|${SEP}RELEASE_PENDING|${SEP}R|\" \
+ -e \"s|${SEP}CLOSED|${SEP}C|\" \
+ -e \"s|${SEP}urgent|${SEP}!!!|\" \
+ -e \"s|${SEP}high|${SEP}!!|\" \
+ -e \"s|${SEP}medium|${SEP} ! |\" \
+ -e \"s|${SEP}low|${SEP} ~ |\" \
+ -e \"s|${SEP}unspecified|${SEP} ? |\" \
+ -e \"s|qa_ack|QA|\" \
+ -e \"s|pm_ack|PM|\" \
+ -e \"s|devel_ack|DE|\" \
+ -e \"s|needinfo|I|\" \
+ -e \"s|exception|E|\" \
+ -e \"s|blocker|BL|\" \
+ -e \"s|requires_release_note|RN|\" \
+ -e \"s|requires_doc_text|RD|\" \
+ -e \"s|docs_scoped|D|g\" \
+ -e \":dsloop\" \
+ -e \"s|\([^A-Z]D-\+\),D-|\1-|g;tdsloop\" \
+ -e \"s|\([^A-Z]D+\+\),D+|\1+|g;tdsloop\" \
+ -e \"s|\([^A-Z]D?\+\),D?|\1?|g;tdsloop\" \
+ -e \"s|rhel-||g\" \
+ -e \"s|qe_test_coverage[?+-][,]\?||\" \
+ -e \"s|None||\" | ${TAIL} | tail -n+${move}" \
+ & while true; do
+ read -n3 -t3 -s char
+ readstatus=$?
+ if test "${readstatus}" -gt 128; then
+ test "${newmove}" -ne 0 && kill $! && break
+ else
+ case "${char}" in
+ $(printf "\e[A")) let newmove-=1;;
+ $(printf "\e[B")) let newmove+=1;;
+ esac
+ fi
+ done
+ echo "Moving by offset ${newmove}..."
+ done
}
do_init