summaryrefslogtreecommitdiffstats
path: root/watch-bz
blob: cf221d46862e11393f0c2193a75f6dab0f643c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

# jpokorny@redhat.com (will be pleased to know about further enhancements)

# usage:
# 1. git clone git://git.fedorahosted.org/git/python-bugzilla
# 2. edit BUGZILLA_ROOT below
# 3. also edit COMPONENT as per example (or pass such string as a 1st argument)
# 4. optionally use "bugzilla login username password" to generate auth. cookie

BUGZILLA_ROOT=~/wrkspc/python-bugzilla
BUGZILLA=${BUGZILLA_ROOT}/bin/bugzilla
export PYTHONPATH=$BUGZILLA_ROOT:$PYTHONPATH

COMPONENT=luci,ricci,clustermon,conga,sunzi
STATUS=OPEN

REFRESH_INTERVAL=600  # [s], better not to drain bugzilla's power...
SEP=@@@
OUTPUT_FMT="%{component}$SEP%{bug_id}$SEP%{priority}$SEP%{status}$SEP%{short_desc}"

if [ $# -ge 1 ]; then
	if [[ "$1" = -* ]]; then
		STATUS=$(echo "$1" | cut -c2-)
		shift
	fi
	if [ $# -ge 1 ]; then
		COMPONENT="$1"
	fi
fi

watch -t --interval $REFRESH_INTERVAL \
  "$BUGZILLA query -c $COMPONENT -t $STATUS --outputformat $OUTPUT_FMT \
  | table-data $SEP \
  | sed -u \
    -e 's/urgent/URGENT/' \
    -e 's/important/IMPORTANT/'"
# todo: colours for priorities (rhbz#801626)
#-e 's/\(urgent\)/\^\[\[31m\1\^\[\[0m/' \