bl 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bl/cli.rb +34 -25
- data/lib/bl/command.rb +8 -1
- data/lib/bl/users.rb +1 -1
- data/lib/bl/version.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: 626f60af1ef5bbb4826c638651491678d100bc17
|
4
|
+
data.tar.gz: 9bb8afac7c45900cf10d422aef4c7d7a074e5551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799682459b708731fa859797a29177e4e88dce270862ec2248bb4ccce413241b4bcd49804fbed14da898b98076f1ed4d885f46837cb3bf79f699d0843975242e
|
7
|
+
data.tar.gz: 19330e9ba70afff70f7a34c0cae19cb14670212cdebc8ccd98bf533779213217cf6511f9e49dbf342137ada862dacb7a91a60738c6977763210422c7d46dfb02
|
data/lib/bl/cli.rb
CHANGED
@@ -77,44 +77,40 @@ module Bl
|
|
77
77
|
end
|
78
78
|
opts[:categoryId] = [-1] if options[:nocategory]
|
79
79
|
res = client.get('issues', opts)
|
80
|
-
print_issue_response(res)
|
80
|
+
print_issue_response(printable_issues(res.body))
|
81
81
|
end
|
82
82
|
|
83
83
|
desc 'search', 'search issues'
|
84
84
|
options ISSUES_PARAMS
|
85
85
|
def search
|
86
86
|
res = client.get('issues', delete_class_options(options.to_h))
|
87
|
-
print_issue_response(res)
|
87
|
+
print_issue_response(printable_issues(res.body))
|
88
88
|
end
|
89
89
|
|
90
90
|
desc 'show KEY', "show an issue's details"
|
91
91
|
def show(key)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
puts
|
104
|
-
|
105
|
-
puts "assignee: #{body.assignee&.name}"
|
106
|
-
puts "created user: #{body.createdUser.name}"
|
92
|
+
res = client.get("issues/#{key}")
|
93
|
+
body = printable_issues(res.body)
|
94
|
+
additional_fileds = %w(
|
95
|
+
description
|
96
|
+
category
|
97
|
+
resolution
|
98
|
+
versions
|
99
|
+
milestone
|
100
|
+
createdUser
|
101
|
+
)
|
102
|
+
fields = ISSUE_FIELDS.concat(additional_fileds)
|
103
|
+
puts formatter.render(body, fields: fields, vertical: true)
|
104
|
+
|
107
105
|
puts '--'
|
108
|
-
puts "description:"
|
109
|
-
puts body.description
|
110
106
|
puts "attachments:"
|
111
|
-
body.attachments.each do |file|
|
107
|
+
body[0].attachments.each do |file|
|
112
108
|
puts ['-', file.id, file.name, file.size].join("\t")
|
113
109
|
puts "\tview url: https://#{@config[:space_id]}.backlog.jp/ViewAttachment.action?attachmentId=#{file.id}"
|
114
110
|
puts "\tdownload url: https://#{@config[:space_id]}.backlog.jp/downloadAttachment/#{file.id}/#{file.name}"
|
115
111
|
end
|
116
112
|
puts "shared files:"
|
117
|
-
body.sharedFiles.each do |file|
|
113
|
+
body[0].sharedFiles.each do |file|
|
118
114
|
puts ['-', file.id, file.name, file.size].join("\t")
|
119
115
|
puts "\tfile url: https://#{@config[:space_id]}.backlog.jp/ViewSharedFile.action?projectKey=#{@config[:project_key]}&sharedFileId=#{file.id}"
|
120
116
|
end
|
@@ -136,7 +132,7 @@ module Bl
|
|
136
132
|
issue_default_options.merge({summary: s}).merge(delete_class_options(options.to_h))
|
137
133
|
)
|
138
134
|
puts '💡 issue added'
|
139
|
-
print_issue_response(res)
|
135
|
+
print_issue_response(printable_issues(res.body))
|
140
136
|
end
|
141
137
|
end
|
142
138
|
|
@@ -147,7 +143,7 @@ module Bl
|
|
147
143
|
keys.each do |k|
|
148
144
|
res = client.patch("issues/#{k}", delete_class_options(options.to_h))
|
149
145
|
puts 'issue updated'
|
150
|
-
print_issue_response(res)
|
146
|
+
print_issue_response(printable_issues(res.body))
|
151
147
|
end
|
152
148
|
end
|
153
149
|
|
@@ -156,7 +152,7 @@ module Bl
|
|
156
152
|
keys.each do |k|
|
157
153
|
res = client.patch("issues/#{k}", statusId: 4)
|
158
154
|
puts '🎉 issue closed'
|
159
|
-
print_issue_response(res)
|
155
|
+
print_issue_response(printable_issues(res.body))
|
160
156
|
end
|
161
157
|
end
|
162
158
|
|
@@ -246,7 +242,20 @@ module Bl
|
|
246
242
|
private
|
247
243
|
|
248
244
|
def print_issue_response(res)
|
249
|
-
puts formatter.render(res
|
245
|
+
puts formatter.render(res, fields: ISSUE_FIELDS)
|
246
|
+
end
|
247
|
+
|
248
|
+
def printable_issues(ary)
|
249
|
+
ary = Array(ary)
|
250
|
+
ary.each do |v|
|
251
|
+
v.issueType = v.issueType.name
|
252
|
+
v.assignee = v.assignee.name if v.assignee
|
253
|
+
v.status = v.status.name
|
254
|
+
v.priority = v.priority.name
|
255
|
+
v.created = format_datetime(v.created)
|
256
|
+
v.updated = format_datetime(v.updated)
|
257
|
+
end
|
258
|
+
ary
|
250
259
|
end
|
251
260
|
end
|
252
261
|
end
|
data/lib/bl/command.rb
CHANGED
@@ -52,8 +52,12 @@ module Bl
|
|
52
52
|
assigneeId: :numeric
|
53
53
|
}
|
54
54
|
ISSUE_FIELDS = %i(
|
55
|
+
issueType
|
55
56
|
issueKey
|
56
57
|
summary
|
58
|
+
assignee
|
59
|
+
status
|
60
|
+
priority
|
57
61
|
startDate
|
58
62
|
dueDate
|
59
63
|
created
|
@@ -132,7 +136,6 @@ module Bl
|
|
132
136
|
created
|
133
137
|
updated
|
134
138
|
)
|
135
|
-
TPUT_COLS = `tput cols`.to_i
|
136
139
|
TYPE_COLORS = %w(
|
137
140
|
#e30000
|
138
141
|
#934981
|
@@ -184,5 +187,9 @@ module Bl
|
|
184
187
|
opts.map { |opt| h.delete(opt) }
|
185
188
|
h
|
186
189
|
end
|
190
|
+
|
191
|
+
def format_datetime(str)
|
192
|
+
DateTime.parse(str).strftime('%Y-%m-%d %H:%M')
|
193
|
+
end
|
187
194
|
end
|
188
195
|
end
|
data/lib/bl/users.rb
CHANGED
data/lib/bl/version.rb
CHANGED