-
Notifications
You must be signed in to change notification settings - Fork 3
/
jira_dashboard.py
42 lines (34 loc) · 1.22 KB
/
jira_dashboard.py
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
40
41
42
#!/usr/local/bin/python
import keyring
import getpass
import argparse
from jira import JIRA
from jira_dashboard_common import *
from config import *
# Arguments
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true")
parser.add_argument("-f", "--format", type=int, default=0, help="printed format of tickets, 0 - default, 1 - CSV")
parser.add_argument("-o", "--order", type=int, default=0, help="sorting for tickets, 0 - default order, 1 - status, 2 - update date")
parser.add_argument("tickets", help="ticket list separated by coma, eg. IOS-123,IOS-456")
args = parser.parse_args()
format_index = args.format
order_index = args.order
setup_vprint(args.verbose)
ORDERING = [
"",
"ORDER BY status ASC",
"ORDER BY updated DESC"
]
if order_index >= len(ORDERING):
order_index = 0
RESULTS = get_ticket_list(args.tickets, ORDERING[order_index])
FORMATS = [
u'{0:2}. {1:10.10}\t{2:16.14}\t{3:20.18}\t{4:88.80}',
u'{0:2}.,{1},{2},{3},{4}'
]
if format_index >= len(FORMATS):
format_index = 0
picked_format = FORMATS[format_index]
for idx, issue in enumerate(RESULTS):
print picked_format.format(idx + 1, issue.key, issue.fields.status, issue.fields.assignee, issue.fields.summary)