From 270e968f8ea85daf14c7bb9ef4e3c1134c12b1b8 Mon Sep 17 00:00:00 2001 From: Mart Somermaa Date: Mon, 9 Jan 2023 22:19:00 +0200 Subject: [PATCH] feat: add command to list issue transitions --- README.md | 1 + ask-jira.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9342cbf..0f82b35 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Here's the default help: 'projects': List available JIRA projects 'sum_timetracking_for_jql': Sum original estimate, time spent and time remaining for all issues that match the given JQL query + 'transitions': List available JIRA transitions for the given issue optional arguments: -h, --help show this help message and exit diff --git a/ask-jira.py b/ask-jira.py index 7f2db63..ddc87b9 100755 --- a/ask-jira.py +++ b/ask-jira.py @@ -22,19 +22,29 @@ def _make_jql_argument_parser(parser): parser.add_argument("jql", help="the JQL query used in the command") return parser +def _make_transitions_argument_parser(parser): + parser.add_argument("issue", help="the JIRA issue key used in the command") + return parser + # commands def projects(jira, args): """List available JIRA projects""" - projects = jira.projects() print("Available JIRA projects:") - pprint.pprint([project.name for project in projects]) + pprint.pprint([project.name for project in jira.projects()]) def fields(jira, args): """List available JIRA field names and IDs""" print("Available JIRA fields (name, id):") pprint.pprint([(field['name'], field['id']) for field in jira.fields()]) +def transitions(jira, args): + """List available JIRA transitions for the given issue""" + print("Available JIRA transitions:") + pprint.pprint(jira.transitions(args.issue)) + +transitions.argparser = _make_transitions_argument_parser + def sum_timetracking_for_jql(jira, args): """Sum original estimate, time spent and time remaining for all issues that match the given JQL query"""