14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/rubee/cli/routes.rb', line 14
def format_routes(routes)
if routes.nil? || routes.empty?
color_puts("No routes found", color: :yellow)
return
end
grouped = routes.group_by { |r| r[:controller] }
width = 100
puts ""
color_puts('═' * width, color: :cyan)
color_puts(" APPLICATION ROUTES", color: :cyan, style: :bold)
color_puts('═' * width, color: :cyan)
puts ""
grouped.each do |controller, controller_routes|
= "┌─ #{controller.upcase} "
padding = '─' * (width - .length)
color_puts( + padding, color: :gray, style: :bold)
controller_routes.each do |route|
print_route(route)
end
color_puts("└#{'─' * (width - 1)}", color: :gray)
end
puts ""
color_puts("Total routes: #{routes.count}", color: :cyan, style: :bold)
end
|