14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/ocak/commands/issue/view.rb', line 14
def call(issue:, **)
config = Config.load
fetcher = LocalIssueFetcher.new(config: config)
data = fetcher.view(issue.to_i)
unless data
warn "Issue ##{issue} not found."
exit 1
end
labels = (data['labels'] || []).map { |l| l['name'] }.join(', ')
puts "##{data['number']} #{data['title']}"
puts "Labels: #{labels}" unless labels.empty?
puts "Complexity: #{data['complexity']}" if data['complexity'] && data['complexity'] != 'full'
puts ''
puts data['body'] unless data['body'].to_s.empty?
path = File.join('.ocak', 'issues', format('%04d.md', issue.to_i))
(path)
rescue Config::ConfigNotFound => e
warn "Error: #{e.message}"
exit 1
end
|