Module: Bl::Formatting

Included in:
CLI, Type
Defined in:
lib/bl/formatting.rb

Class Method Summary collapse

Class Method Details

.colorize_priority(id, name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bl/formatting.rb', line 9

def colorize_priority(id, name)
  case id
  when 2
    Paint[name, :black, '#ffcccc']
  when 3
    Paint[name, :black, '#ccccff']
  when 4
    Paint[name, :black, '#ccffcc']
  else
    raise 'error'
  end
end

.colorize_status(id, name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bl/formatting.rb', line 22

def colorize_status(id, name)
  case id
  when 1
    Paint[name, :black, '#ffcccc']
  when 2
    Paint[name, :black, '#acd9d3']
  when 3
    Paint[name, :black, '#d3e0ef']
  when 4
    Paint[name, :black, '#c2d3a3']
  else
    raise 'error'
  end
end

.colorize_type(name, color) ⇒ Object



5
6
7
# File 'lib/bl/formatting.rb', line 5

def colorize_type(name, color)
  Paint[name, :white, color]
end


37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/bl/formatting.rb', line 37

def print_issue(issue)
  puts [
    colorize_type(issue.issueType.name, issue.issueType.color),
    issue.issueKey,
    issue.summary,
    colorize_priority(issue.priority.id, issue.priority.name),
    issue.created,
    issue.dueDate,
    issue.updated,
    issue.createdUser.name,
    issue.assignee&.name,
    colorize_status(issue.status.id, issue.status.name)
  ].join("\t")
end