-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathjira-list
More file actions
executable file
·49 lines (40 loc) · 1.54 KB
/
jira-list
File metadata and controls
executable file
·49 lines (40 loc) · 1.54 KB
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
43
44
45
46
47
48
49
#!/bin/env python
"""
use the api token from jira: https://id.atlassian.com/manage-profile/security/api-tokens
# add to ~/.bashrc
export JIRA_API_TOKEN=""
export JIRA_USER=""
export JIRA_URL="https://myjira.atlassian.net/"
# install
pip install jira colorama
"""
from jira import JIRA
import os
import subprocess
import re
from colorama import Fore, Back, Style
import argparse
token = os.environ.get("JIRA_API_TOKEN")
user = os.environ.get("JIRA_USER")
jira_url = os.environ.get("JIRA_URL")
jira = JIRA(server=jira_url, basic_auth=(user, token))
def main(args):
if args.summary:
result = jira.issue(args.summary, fields='description')
print(f"{result.fields.description or ''}")
return
result = jira.search_issues(""" (assignee = currentUser()) and statuscategory IN ("In Progress","New") ORDER BY updated""")
for j in result:
if args.title:
print(f"{j.key} {j.fields.summary}")
elif args.link:
print(f"{j.key} {j.permalink()}")
else:
print(f"{j.key} {j.fields.assignee} {Fore.LIGHTWHITE_EX} {j.fields.status} {Fore.CYAN}{j.fields.summary} {Fore.RESET}{j.permalink()} ")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='List jira issues .. made by zodman')
parser.add_argument("-t","--title",help="only show ID and title", action="store_true")
parser.add_argument("-l","--link",help="show only links", action="store_true")
parser.add_argument("-s","--summary",help="show sumary")
args = parser.parse_args()
main(args)