jira-cli 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jira/commands/describe.rb +23 -14
- data/lib/jira/constants.rb +1 -1
- data/lib/jira/core.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2036d8670e831787e5b06238d5989db70d5d28e
|
4
|
+
data.tar.gz: 04a472335c54b49ca44dd7af30fe670a61f2863b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51286f2fa3d9a52b79ad227ae62a646834881226204e66c828ba50c2e6c37bdc60bf494c16d69cdee8ce65b827e2e2355a5d0700ca5ed74f72c091cc6d1e4c5d
|
7
|
+
data.tar.gz: 623822ac5a21589ee525683829f69c41bc407ba14261b8122d647c28f0de9155894188dd363b49b43760d27d87dd1e61cc35dc921c4ed836406265c9e5d4bc2e
|
@@ -3,7 +3,7 @@ module Jira
|
|
3
3
|
|
4
4
|
desc "describe", "Describes the input ticket"
|
5
5
|
def describe(ticket=Jira::Core.ticket)
|
6
|
-
puts description(ticket.strip)
|
6
|
+
puts description(ticket.strip, false, true)
|
7
7
|
end
|
8
8
|
|
9
9
|
desc "all", "Describes all local branches that match JIRA ticketing syntax"
|
@@ -30,17 +30,20 @@ module Jira
|
|
30
30
|
# asynchronously fetch and describe tickets
|
31
31
|
output = ""
|
32
32
|
threads = []
|
33
|
-
|
33
|
+
if Jira::Core.ticket?(tickets[:current])
|
34
|
+
threads << Thread.new{ puts description(tickets[:current], true) }
|
35
|
+
end
|
34
36
|
mutex = Mutex.new
|
35
37
|
tickets[:others].each do |ticket|
|
36
38
|
threads << Thread.new do
|
37
39
|
out = description(ticket) + "\n"
|
38
|
-
|
40
|
+
if !out.strip.empty?
|
41
|
+
mutex.synchronize{ output << out }
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
threads.each{ |thread| thread.join }
|
42
|
-
|
43
|
-
puts output
|
46
|
+
puts output if !output.empty?
|
44
47
|
end
|
45
48
|
|
46
49
|
protected
|
@@ -53,16 +56,22 @@ module Jira
|
|
53
56
|
#
|
54
57
|
# @return [String] formatted summary string
|
55
58
|
#
|
56
|
-
def description(ticket, star=false)
|
59
|
+
def description(ticket, star=false, verbose=false)
|
57
60
|
json = @api.get("issue/#{ticket}")
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
if json['errorMessages'].nil?
|
62
|
+
summary = json['fields']['summary']
|
63
|
+
status = json['fields']['status']['name']
|
64
|
+
assignee = json['fields']['assignee']['name']
|
65
|
+
return Jira::Format.ticket(ticket) +
|
66
|
+
(star ? Jira::Format.star : " ") + " " +
|
67
|
+
("(" + Jira::Format.user(assignee) + ")").ljust(20) +
|
68
|
+
Jira::Format.status(status).ljust(26) +
|
69
|
+
Jira::Format.summary(summary)
|
70
|
+
elsif verbose
|
71
|
+
return json['errorMessages'].join('. ')
|
72
|
+
else
|
73
|
+
return ""
|
74
|
+
end
|
66
75
|
end
|
67
76
|
|
68
77
|
end
|
data/lib/jira/constants.rb
CHANGED
data/lib/jira/core.rb
CHANGED