32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/jira_command/command/transition.rb', line 32
def issue
jql = []
jql << 'sprint in openSprints()' unless options['current'].nil?
jql << 'assignee=currentUser()' unless options['mine'].nil?
config = JiraCommand::Config.new.read
list = JiraCommand::Jira::List.new(config)
issues_list = list.list({ fields: 'key,status,assignee,summary',
jql: jql.join('&') })
prompt = TTY::Prompt.new
issue_key = prompt.select('Which issue do you want to transite?') do ||
issues_list['issues'].map do |i|
assignee = i['fields']['assignee']
.choice(name: "#{assignee.nil? ? 'not assigned' : assignee['displayName']}: #{i['fields']['summary']}(#{i['fields']['status']['name']})",
value: i['key'])
end
end
jira = JiraCommand::Jira::Transition.new(config)
res = jira.list(issue_key: issue_key)
target_transition_id = prompt.select('Which status do you want to transite?') do ||
res.each do |transition|
.choice name: transition[:name], value: transition[:id]
end
end
jira.transite(issue_key: issue_key, target_transition_id: target_transition_id)
end
|