Skip to content

Commit

Permalink
jipsearch: flag parent
Browse files Browse the repository at this point in the history
This will show the parent Epic/Story/Task if any.

Signed-off-by: Anders Roxell <[email protected]>
  • Loading branch information
roxell committed Jun 27, 2023
1 parent 65ce08c commit 107a8c2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions jipdate/jipsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ def get_parser():
help="""Show information about a specific Epic/Story/Task.""",
)

parser.add_argument(
"-pk",
"--parent",
required=False,
action="store_true",
default=False,
help="""print parent key if available.""",
)

parser.add_argument(
"-v",
required=False,
Expand Down Expand Up @@ -267,6 +276,9 @@ def search_issues(jira, jql):
for keys in re.findall(regex, cfg.args.format):
fields.append(keys.split(":")[0])

if cfg.args.parent:
fields.append("parent")

result = jira.search_issues(
jql,
startAt=result["startAt"],
Expand Down Expand Up @@ -314,6 +326,15 @@ def print_issues(jira, issues):
assignee_ = f", Assignee: {issue['fields']['assignee']['displayName']}, Assignee email: {issue['fields']['assignee']['emailAddress']}"
output += assignee_

if cfg.args.parent:
try:
field = issue["fields"]["parent"]
value = f" parent: {jira_link}/{field['key']}"
print(f"{output},{value}")
except KeyError:
print(f"No key 'parent'.")
continue

print(f"{output}")
if cfg.args.description:
print(f"# Description:")
Expand Down

0 comments on commit 107a8c2

Please sign in to comment.