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
49
50
51
|
# File 'lib/tng/ui/configuration_display.rb', line 18
def display_missing_config(missing_config)
config_content = [
@pastel.public_send(Tng::UI::Theme.color(:error)).bold("Configuration Required"),
"",
@pastel.public_send(Tng::UI::Theme.color(:accent), "Missing required configuration:"),
missing_config.map do |key|
@pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:bullet)} #{key}")
end.join("\n"),
"",
@pastel.public_send(Tng::UI::Theme.color(:secondary), "Quick fix:"),
@pastel.public_send(Tng::UI::Theme.color(:muted),
"#{Tng::UI::Theme.icon(:bullet)} Edit config/initializers/tng.rb"),
@pastel.public_send(Tng::UI::Theme.color(:muted),
"#{Tng::UI::Theme.icon(:bullet)} Set your API key and other required values"),
"",
@pastel.public_send(Tng::UI::Theme.color(:success), "Press Enter to continue after fixing"),
@pastel.public_send(Tng::UI::Theme.color(:error), "Press Ctrl+C to exit")
].join("\n")
box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
style = Tng::UI::Theme.box_style(:error)
config_box = TTY::Box.frame(
title: { top_left: " Config Required " },
style: style[:style],
padding: style[:padding],
width: box_width
) do
config_content
end
puts Tng::UI::Theme.center_box(config_box, box_width, @terminal_width)
puts
end
|