lazyrails-tui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lazyrails/app.rb +2 -2
- data/lib/lazyrails/command_log_overlay.rb +2 -2
- data/lib/lazyrails/generator_wizard.rb +19 -19
- data/lib/lazyrails/help_overlay.rb +5 -5
- data/lib/lazyrails/input_mode.rb +1 -1
- data/lib/lazyrails/menu_overlay.rb +3 -3
- data/lib/lazyrails/renderer.rb +26 -26
- data/lib/lazyrails/table_browser.rb +5 -5
- data/lib/lazyrails/version.rb +1 -1
- data/lib/lazyrails/view_helpers.rb +5 -5
- data/lib/lazyrails/views/command_log_view.rb +3 -3
- data/lib/lazyrails/views/console_view.rb +2 -2
- data/lib/lazyrails/views/credentials_view.rb +2 -2
- data/lib/lazyrails/views/database_view.rb +2 -2
- data/lib/lazyrails/views/error_view.rb +2 -2
- data/lib/lazyrails/views/jobs_view.rb +6 -6
- data/lib/lazyrails/views/log_view.rb +2 -2
- data/lib/lazyrails/views/mailer_view.rb +1 -1
- data/lib/lazyrails/views/models_view.rb +1 -1
- data/lib/lazyrails/views/rake_view.rb +1 -1
- data/lib/lazyrails/views/routes_view.rb +1 -1
- data/lib/lazyrails/views/tests_view.rb +1 -1
- data/lib/lazyrails/welcome_overlay.rb +3 -3
- data/lib/lazyrails.rb +0 -2
- metadata +4 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc816c3d5deb7d2fd1a081d3347b60dd8c38410205f941f749554c6d51bfd6b6
|
|
4
|
+
data.tar.gz: 1d758431f7fe824002391b60a217b0df91c10d47be80c36547e1b771671b7ff4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f76b9c1fcbd626d6ade54cd3216099145b5d1472d89466b0c71cdaeea8bc13c5362b6ef4a22d2850b95b2eed596ae2199dff13cfce688deed50b3c5c547c9b2d
|
|
7
|
+
data.tar.gz: 90aac8abb3159ea05691929a3d7e91265d1a88827baa62d87dcd2f45592128838fb79740133cc7137ec434cbfb3c625075858d998742ee83e8e0cad0c7368e62
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A [lazygit](https://github.com/jesseduffield/lazygit)-style terminal UI for Rail
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
Built with [Chamomile](https://github.com/
|
|
7
|
+
Built with [Chamomile](https://github.com/chamomile-rb/chamomile) — the complete Ruby TUI framework.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
data/lib/lazyrails/app.rb
CHANGED
|
@@ -59,7 +59,7 @@ module LazyRails
|
|
|
59
59
|
@command_log = CommandLog.new
|
|
60
60
|
@server = ServerManager.new(project)
|
|
61
61
|
@log_watcher = LogWatcher.new(project)
|
|
62
|
-
@detail_viewport =
|
|
62
|
+
@detail_viewport = Chamomile::Viewport.new(width: 40, height: 20)
|
|
63
63
|
|
|
64
64
|
# Component objects
|
|
65
65
|
@flash = Flash.new
|
|
@@ -163,7 +163,7 @@ module LazyRails
|
|
|
163
163
|
left_content = render_left_panels(left_width)
|
|
164
164
|
right_content = render_right_pane(right_width)
|
|
165
165
|
|
|
166
|
-
layout =
|
|
166
|
+
layout = Chamomile.horizontal([left_content, " ", right_content], align: :top)
|
|
167
167
|
|
|
168
168
|
base = if @input_mode.active?
|
|
169
169
|
"#{layout}\n#{render_filter_bar}"
|
|
@@ -49,14 +49,14 @@ module LazyRails
|
|
|
49
49
|
def render(width:)
|
|
50
50
|
return "No commands executed yet.\n\nPress L or Esc to close." if @command_log.empty?
|
|
51
51
|
|
|
52
|
-
header =
|
|
52
|
+
header = Chamomile::Style.new.bold.render("Command Log")
|
|
53
53
|
list = Views::CommandLogView.render(@command_log, width: width - 4, selected: @cursor)
|
|
54
54
|
|
|
55
55
|
parts = [header, "", list]
|
|
56
56
|
|
|
57
57
|
if @detail
|
|
58
58
|
parts << ""
|
|
59
|
-
parts <<
|
|
59
|
+
parts << Chamomile::Style.new.bold.render("Detail")
|
|
60
60
|
parts << Views::CommandLogView.render_detail(@detail, width: width - 4)
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -85,9 +85,9 @@ module LazyRails
|
|
|
85
85
|
step_label = step_indicator
|
|
86
86
|
footer = render_footer
|
|
87
87
|
|
|
88
|
-
box =
|
|
88
|
+
box = Chamomile::Style.new
|
|
89
89
|
.width(menu_width)
|
|
90
|
-
.border(
|
|
90
|
+
.border(Chamomile::Border::ROUNDED)
|
|
91
91
|
.border_foreground("#b48ead")
|
|
92
92
|
.padding(0, 1)
|
|
93
93
|
.render("#{content}\n\n#{footer}")
|
|
@@ -95,7 +95,7 @@ module LazyRails
|
|
|
95
95
|
box_lines = box.lines
|
|
96
96
|
if box_lines.any?
|
|
97
97
|
title_text = " Generate #{@gen_label} #{step_label} "
|
|
98
|
-
title_styled =
|
|
98
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
99
99
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -159,14 +159,14 @@ module LazyRails
|
|
|
159
159
|
lines << ""
|
|
160
160
|
|
|
161
161
|
prompt = "> #{@name}\u2588"
|
|
162
|
-
lines <<
|
|
162
|
+
lines << Chamomile::Style.new.bold.render(prompt)
|
|
163
163
|
|
|
164
164
|
lines << ""
|
|
165
|
-
lines <<
|
|
165
|
+
lines << Chamomile::Style.new.foreground("#666666").render(name_hint)
|
|
166
166
|
|
|
167
167
|
if @error
|
|
168
168
|
lines << ""
|
|
169
|
-
lines <<
|
|
169
|
+
lines << Chamomile::Style.new.foreground("#ff6347").render(@error)
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
lines.join("\n")
|
|
@@ -260,7 +260,7 @@ module LazyRails
|
|
|
260
260
|
# Show existing fields
|
|
261
261
|
if @fields.any?
|
|
262
262
|
@fields.each_with_index do |f, i|
|
|
263
|
-
marker =
|
|
263
|
+
marker = Chamomile::Style.new.foreground("#a3be8c").render("\u2713")
|
|
264
264
|
lines << " #{marker} #{f[:name]}:#{f[:type]}"
|
|
265
265
|
end
|
|
266
266
|
lines << ""
|
|
@@ -270,9 +270,9 @@ module LazyRails
|
|
|
270
270
|
lines << "Field name: #{@field_name_input}\u2588"
|
|
271
271
|
lines << ""
|
|
272
272
|
hint = @fields.empty? ? "Type a field name, then press Enter to pick its type" : "Type a field name, Enter to pick type, Enter with empty to finish"
|
|
273
|
-
lines <<
|
|
273
|
+
lines << Chamomile::Style.new.foreground("#666666").render(hint)
|
|
274
274
|
if @fields.any?
|
|
275
|
-
lines <<
|
|
275
|
+
lines << Chamomile::Style.new.foreground("#666666").render("Backspace with empty input to remove last field")
|
|
276
276
|
end
|
|
277
277
|
else
|
|
278
278
|
lines << "Pick type for '#{@field_name_input}':"
|
|
@@ -288,7 +288,7 @@ module LazyRails
|
|
|
288
288
|
|
|
289
289
|
if @error
|
|
290
290
|
lines << ""
|
|
291
|
-
lines <<
|
|
291
|
+
lines << Chamomile::Style.new.foreground("#ff6347").render(@error)
|
|
292
292
|
end
|
|
293
293
|
|
|
294
294
|
lines.join("\n")
|
|
@@ -331,17 +331,17 @@ module LazyRails
|
|
|
331
331
|
|
|
332
332
|
CONTROLLER_ACTIONS.each_with_index do |action, i|
|
|
333
333
|
checked = @action_toggles[action]
|
|
334
|
-
marker = checked ?
|
|
334
|
+
marker = checked ? Chamomile::Style.new.foreground("#a3be8c").render("[x]") : "[ ]"
|
|
335
335
|
text = "#{marker} #{action}"
|
|
336
336
|
if i == @action_cursor
|
|
337
|
-
lines << ViewHelpers.selected_style.render(" #{
|
|
337
|
+
lines << ViewHelpers.selected_style.render(" #{Chamomile::ANSI.strip(text)} ")
|
|
338
338
|
else
|
|
339
339
|
lines << " #{text}"
|
|
340
340
|
end
|
|
341
341
|
end
|
|
342
342
|
|
|
343
343
|
lines << ""
|
|
344
|
-
lines <<
|
|
344
|
+
lines << Chamomile::Style.new.foreground("#666666").render("Space toggle | a toggle all | Enter continue")
|
|
345
345
|
|
|
346
346
|
lines.join("\n")
|
|
347
347
|
end
|
|
@@ -389,7 +389,7 @@ module LazyRails
|
|
|
389
389
|
|
|
390
390
|
if @methods.any?
|
|
391
391
|
@methods.each do |m|
|
|
392
|
-
marker =
|
|
392
|
+
marker = Chamomile::Style.new.foreground("#a3be8c").render("\u2713")
|
|
393
393
|
lines << " #{marker} #{m}"
|
|
394
394
|
end
|
|
395
395
|
lines << ""
|
|
@@ -398,14 +398,14 @@ module LazyRails
|
|
|
398
398
|
lines << "Method name: #{@method_input}\u2588"
|
|
399
399
|
lines << ""
|
|
400
400
|
hint = @methods.empty? ? "Type a method name and press Enter" : "Enter another method, or Enter with empty to finish"
|
|
401
|
-
lines <<
|
|
401
|
+
lines << Chamomile::Style.new.foreground("#666666").render(hint)
|
|
402
402
|
if @methods.any?
|
|
403
|
-
lines <<
|
|
403
|
+
lines << Chamomile::Style.new.foreground("#666666").render("Backspace with empty input to remove last method")
|
|
404
404
|
end
|
|
405
405
|
|
|
406
406
|
if @error
|
|
407
407
|
lines << ""
|
|
408
|
-
lines <<
|
|
408
|
+
lines << Chamomile::Style.new.foreground("#ff6347").render(@error)
|
|
409
409
|
end
|
|
410
410
|
|
|
411
411
|
lines.join("\n")
|
|
@@ -435,11 +435,11 @@ module LazyRails
|
|
|
435
435
|
cmd_str = cmd.join(" ")
|
|
436
436
|
|
|
437
437
|
lines = []
|
|
438
|
-
lines <<
|
|
438
|
+
lines << Chamomile::Style.new.foreground("#a3be8c").bold.render("Ready to generate!")
|
|
439
439
|
lines << ""
|
|
440
440
|
|
|
441
441
|
lines << "Command:"
|
|
442
|
-
lines <<
|
|
442
|
+
lines << Chamomile::Style.new.bold.render(" $ #{cmd_str}")
|
|
443
443
|
lines << ""
|
|
444
444
|
|
|
445
445
|
# Summary
|
|
@@ -107,9 +107,9 @@ module LazyRails
|
|
|
107
107
|
scroll_hint = @scroll < max_scroll ? " | j/k scroll" : ""
|
|
108
108
|
footer = "? or Esc close#{scroll_hint}"
|
|
109
109
|
|
|
110
|
-
box =
|
|
110
|
+
box = Chamomile::Style.new
|
|
111
111
|
.width(box_width)
|
|
112
|
-
.border(
|
|
112
|
+
.border(Chamomile::Border::ROUNDED)
|
|
113
113
|
.border_foreground("#b48ead")
|
|
114
114
|
.padding(0, 1)
|
|
115
115
|
.render("#{content}\n\n#{footer}")
|
|
@@ -117,7 +117,7 @@ module LazyRails
|
|
|
117
117
|
box_lines = box.lines
|
|
118
118
|
if box_lines.any?
|
|
119
119
|
title_text = " Keybindings "
|
|
120
|
-
title_styled =
|
|
120
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
121
121
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
122
122
|
end
|
|
123
123
|
|
|
@@ -130,9 +130,9 @@ module LazyRails
|
|
|
130
130
|
lines = []
|
|
131
131
|
SECTIONS.each_with_index do |section, i|
|
|
132
132
|
lines << "" if i > 0
|
|
133
|
-
lines <<
|
|
133
|
+
lines << Chamomile::Style.new.bold.foreground("#b48ead").render(section[:section])
|
|
134
134
|
section[:bindings].each do |key, desc|
|
|
135
|
-
key_styled =
|
|
135
|
+
key_styled = Chamomile::Style.new.bold.render(key.ljust(18))
|
|
136
136
|
lines << " #{key_styled} #{desc}"
|
|
137
137
|
end
|
|
138
138
|
end
|
data/lib/lazyrails/input_mode.rb
CHANGED
|
@@ -77,9 +77,9 @@ module LazyRails
|
|
|
77
77
|
content = lines.join("\n")
|
|
78
78
|
footer = "j/k navigate | Enter select | Esc close"
|
|
79
79
|
|
|
80
|
-
box =
|
|
80
|
+
box = Chamomile::Style.new
|
|
81
81
|
.width(menu_width)
|
|
82
|
-
.border(
|
|
82
|
+
.border(Chamomile::Border::ROUNDED)
|
|
83
83
|
.border_foreground("#b48ead")
|
|
84
84
|
.padding(0, 1)
|
|
85
85
|
.render("#{content}\n\n#{footer}")
|
|
@@ -88,7 +88,7 @@ module LazyRails
|
|
|
88
88
|
box_lines = box.lines
|
|
89
89
|
if box_lines.any?
|
|
90
90
|
title_text = " #{@title} "
|
|
91
|
-
title_styled =
|
|
91
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
92
92
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
93
93
|
end
|
|
94
94
|
|
data/lib/lazyrails/renderer.rb
CHANGED
|
@@ -25,17 +25,17 @@ module LazyRails
|
|
|
25
25
|
content = render_panel_content(panel, width: width - 4, height: h - 2, focused: focused)
|
|
26
26
|
|
|
27
27
|
border_color = focused ? FOCUSED_COLOR : UNFOCUSED_COLOR
|
|
28
|
-
box =
|
|
28
|
+
box = Chamomile::Style.new
|
|
29
29
|
.width(width)
|
|
30
30
|
.height(h)
|
|
31
|
-
.border(
|
|
31
|
+
.border(Chamomile::Border::ROUNDED)
|
|
32
32
|
.border_foreground(border_color)
|
|
33
33
|
.render(content)
|
|
34
34
|
|
|
35
35
|
box_lines = box.lines
|
|
36
36
|
if box_lines.any?
|
|
37
37
|
title = " #{panel.title} "
|
|
38
|
-
title_styled =
|
|
38
|
+
title_styled = Chamomile::Style.new.foreground(border_color).bold.render(title)
|
|
39
39
|
box_lines[0] = inject_title(box_lines[0], title_styled, title.length)
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ module LazyRails
|
|
|
44
44
|
sections << output
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Chamomile.vertical(sections, align: :left)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def panel_cache_key(panel, focused, width, height)
|
|
@@ -104,7 +104,7 @@ module LazyRails
|
|
|
104
104
|
when :jobs then Views::JobsView.render_item(item, selected: selected, width: width)
|
|
105
105
|
when :custom then Views::CustomCommandsView.render_item(item, selected: selected, width: width)
|
|
106
106
|
else
|
|
107
|
-
selected ?
|
|
107
|
+
selected ? Chamomile::Style.new.reverse.render(item.to_s) : item.to_s
|
|
108
108
|
end
|
|
109
109
|
end.join("\n")
|
|
110
110
|
end
|
|
@@ -117,17 +117,17 @@ module LazyRails
|
|
|
117
117
|
content = @detail_viewport.view
|
|
118
118
|
border_color = UNFOCUSED_COLOR
|
|
119
119
|
|
|
120
|
-
box =
|
|
120
|
+
box = Chamomile::Style.new
|
|
121
121
|
.width(width)
|
|
122
122
|
.height(@height - 2)
|
|
123
|
-
.border(
|
|
123
|
+
.border(Chamomile::Border::ROUNDED)
|
|
124
124
|
.border_foreground(border_color)
|
|
125
125
|
.render(content)
|
|
126
126
|
|
|
127
127
|
box_lines = box.lines
|
|
128
128
|
if box_lines.any?
|
|
129
129
|
title = " Detail "
|
|
130
|
-
title_styled =
|
|
130
|
+
title_styled = Chamomile::Style.new.foreground(border_color).bold.render(title)
|
|
131
131
|
box_lines[0] = inject_title(box_lines[0], title_styled, title.length)
|
|
132
132
|
end
|
|
133
133
|
|
|
@@ -194,7 +194,7 @@ module LazyRails
|
|
|
194
194
|
|
|
195
195
|
def render_status_bar
|
|
196
196
|
if @flash.active?
|
|
197
|
-
return
|
|
197
|
+
return Chamomile::Style.new.foreground("#e5c07b").width(@width).render(" #{@flash.message}".slice(0, @width))
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
hints = [
|
|
@@ -202,27 +202,27 @@ module LazyRails
|
|
|
202
202
|
["x", "actions"], ["L", "log"], ["?", "help"], ["q", "quit"]
|
|
203
203
|
]
|
|
204
204
|
bar = " " + hints.map do |key, desc|
|
|
205
|
-
styled_key =
|
|
205
|
+
styled_key = Chamomile::Style.new.bold.foreground("#b48ead").render(key)
|
|
206
206
|
"#{styled_key} #{desc}"
|
|
207
207
|
end.join(" \u2502 ")
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
Chamomile::Style.new.foreground("#999999").width(@width).render(bar)
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
def render_filter_bar
|
|
213
|
-
label =
|
|
213
|
+
label = Chamomile::Style.new.bold.foreground("#b48ead").render(" #{@input_mode.styled_label}")
|
|
214
214
|
input = @input_mode.view
|
|
215
|
-
hints =
|
|
215
|
+
hints = Chamomile::Style.new.foreground("#666666").render("Enter submit \u2502 Esc cancel ")
|
|
216
216
|
|
|
217
217
|
hints_len = "Enter submit | Esc cancel ".length
|
|
218
218
|
label_len = @input_mode.styled_label.length + 1
|
|
219
219
|
input_area = @width - label_len - hints_len
|
|
220
220
|
|
|
221
221
|
# Build: [label][input padding...][hints]
|
|
222
|
-
input_visible =
|
|
222
|
+
input_visible = Chamomile::ANSI.printable_width(input)
|
|
223
223
|
padding = input_area > input_visible ? " " * (input_area - input_visible) : ""
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
Chamomile::Style.new.width(@width).render("#{label}#{input}#{padding}#{hints}")
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
def render_confirmation_box
|
|
@@ -235,19 +235,19 @@ module LazyRails
|
|
|
235
235
|
cmd = @confirmation.command.is_a?(Array) ? @confirmation.command.join(" ") : @confirmation.command.to_s
|
|
236
236
|
|
|
237
237
|
lines = []
|
|
238
|
-
lines <<
|
|
238
|
+
lines << Chamomile::Style.new.foreground(color).bold.render(cmd)
|
|
239
239
|
lines << ""
|
|
240
240
|
lines << text
|
|
241
241
|
lines << ""
|
|
242
|
-
lines <<
|
|
242
|
+
lines << Chamomile::Style.new.foreground("#666666").render("Esc cancel")
|
|
243
243
|
content = lines.join("\n")
|
|
244
244
|
|
|
245
245
|
box_width = [[cmd.length + 6, text.length + 6].max, @width - 8].min
|
|
246
246
|
box_width = [box_width, 30].max
|
|
247
247
|
|
|
248
|
-
box =
|
|
248
|
+
box = Chamomile::Style.new
|
|
249
249
|
.width(box_width)
|
|
250
|
-
.border(
|
|
250
|
+
.border(Chamomile::Border::ROUNDED)
|
|
251
251
|
.border_foreground(color)
|
|
252
252
|
.padding(0, 1)
|
|
253
253
|
.render(content)
|
|
@@ -255,7 +255,7 @@ module LazyRails
|
|
|
255
255
|
box_lines = box.lines
|
|
256
256
|
if box_lines.any?
|
|
257
257
|
title_text = " Confirm "
|
|
258
|
-
title_styled =
|
|
258
|
+
title_styled = Chamomile::Style.new.foreground(color).bold.render(title_text)
|
|
259
259
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
260
260
|
end
|
|
261
261
|
|
|
@@ -268,10 +268,10 @@ module LazyRails
|
|
|
268
268
|
box_width = [@width - 4, 60].max
|
|
269
269
|
box_width = [box_width, @width - 2].min
|
|
270
270
|
|
|
271
|
-
box =
|
|
271
|
+
box = Chamomile::Style.new
|
|
272
272
|
.width(box_width)
|
|
273
273
|
.height(@height - 4)
|
|
274
|
-
.border(
|
|
274
|
+
.border(Chamomile::Border::ROUNDED)
|
|
275
275
|
.border_foreground("#b48ead")
|
|
276
276
|
.padding(0, 1)
|
|
277
277
|
.render(content)
|
|
@@ -279,7 +279,7 @@ module LazyRails
|
|
|
279
279
|
box_lines = box.lines
|
|
280
280
|
if box_lines.any?
|
|
281
281
|
title_text = " Command Log "
|
|
282
|
-
title_styled =
|
|
282
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
283
283
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
284
284
|
end
|
|
285
285
|
|
|
@@ -292,10 +292,10 @@ module LazyRails
|
|
|
292
292
|
box_width = [@width - 4, 60].max
|
|
293
293
|
box_width = [box_width, @width - 2].min
|
|
294
294
|
|
|
295
|
-
box =
|
|
295
|
+
box = Chamomile::Style.new
|
|
296
296
|
.width(box_width)
|
|
297
297
|
.height(@height - 4)
|
|
298
|
-
.border(
|
|
298
|
+
.border(Chamomile::Border::ROUNDED)
|
|
299
299
|
.border_foreground("#b48ead")
|
|
300
300
|
.padding(0, 1)
|
|
301
301
|
.render(content)
|
|
@@ -303,7 +303,7 @@ module LazyRails
|
|
|
303
303
|
box_lines = box.lines
|
|
304
304
|
if box_lines.any?
|
|
305
305
|
title_text = " Table Browser "
|
|
306
|
-
title_styled =
|
|
306
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
307
307
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
308
308
|
end
|
|
309
309
|
|
|
@@ -71,7 +71,7 @@ module LazyRails
|
|
|
71
71
|
row.map { |v| v.nil? ? "NULL" : v.to_s }
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
@table_widget =
|
|
74
|
+
@table_widget = Chamomile::Table.new(rows: table_rows) do |t|
|
|
75
75
|
columns.each { |col| t.column col, width: column_width(col, columns.size) }
|
|
76
76
|
end
|
|
77
77
|
end
|
|
@@ -199,7 +199,7 @@ module LazyRails
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
def render_table_list(width, height)
|
|
202
|
-
header =
|
|
202
|
+
header = Chamomile::Style.new.bold.render("Select a Table (#{@tables.size})")
|
|
203
203
|
lines = [header, ""]
|
|
204
204
|
|
|
205
205
|
if @tables.empty?
|
|
@@ -226,7 +226,7 @@ module LazyRails
|
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
def render_row_data(_width, height)
|
|
229
|
-
header =
|
|
229
|
+
header = Chamomile::Style.new.bold.render("Table: #{@selected_table}")
|
|
230
230
|
lines = [header, ""]
|
|
231
231
|
|
|
232
232
|
# Status line with query info
|
|
@@ -235,13 +235,13 @@ module LazyRails
|
|
|
235
235
|
status_parts << "ORDER BY #{order_expression}" if @order_column
|
|
236
236
|
status_parts << "Page #{@page + 1}/#{total_pages} (#{@total_rows} rows)"
|
|
237
237
|
status_line = status_parts.join(" | ")
|
|
238
|
-
lines <<
|
|
238
|
+
lines << Chamomile::Style.new.foreground("#888888").render(status_line)
|
|
239
239
|
lines << ""
|
|
240
240
|
|
|
241
241
|
if @loading
|
|
242
242
|
lines << "Loading..."
|
|
243
243
|
elsif @error
|
|
244
|
-
lines <<
|
|
244
|
+
lines << Chamomile::Style.new.foreground("#ff6347").render("Error: #{@error}")
|
|
245
245
|
elsif @table_widget
|
|
246
246
|
@table_widget.height = [height - 7, 3].max
|
|
247
247
|
lines << @table_widget.view
|
data/lib/lazyrails/version.rb
CHANGED
|
@@ -9,7 +9,7 @@ module LazyRails
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.selected_style
|
|
12
|
-
|
|
12
|
+
Chamomile::Style.new.bold.reverse
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def self.classify_name(name)
|
|
@@ -24,10 +24,10 @@ module LazyRails
|
|
|
24
24
|
box_lines = popup_box.split("\n", -1)
|
|
25
25
|
|
|
26
26
|
# Remove trailing empty lines from box
|
|
27
|
-
box_lines.pop while box_lines.last&.then { |l|
|
|
27
|
+
box_lines.pop while box_lines.last&.then { |l| Chamomile::ANSI.strip(l).strip.empty? }
|
|
28
28
|
|
|
29
29
|
box_h = box_lines.size
|
|
30
|
-
box_w = box_lines.map { |l|
|
|
30
|
+
box_w = box_lines.map { |l| Chamomile::ANSI.printable_width(l) }.max || 0
|
|
31
31
|
|
|
32
32
|
# Center position
|
|
33
33
|
start_row = [(screen_height - box_h) / 2, 0].max
|
|
@@ -52,9 +52,9 @@ module LazyRails
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Injects a styled title into the first line of a bordered box.
|
|
55
|
-
# Used by Renderer and MenuOverlay to add titles to
|
|
55
|
+
# Used by Renderer and MenuOverlay to add titles to Chamomile borders.
|
|
56
56
|
def self.inject_title(top_line, styled_title, title_visible_len)
|
|
57
|
-
stripped =
|
|
57
|
+
stripped = Chamomile::ANSI.strip(top_line)
|
|
58
58
|
return top_line if stripped.length <= title_visible_len + 2
|
|
59
59
|
|
|
60
60
|
ansi_prefix = top_line[/\A((?:\e\[[0-9;]*m)*)/] || ""
|
|
@@ -19,18 +19,18 @@ module LazyRails
|
|
|
19
19
|
if i == selected
|
|
20
20
|
lines << ViewHelpers.selected_style.render(text)
|
|
21
21
|
else
|
|
22
|
-
styled_icon =
|
|
22
|
+
styled_icon = Chamomile::Style.new.foreground(color).render(icon)
|
|
23
23
|
lines << "#{styled_icon} #{cmd_text.ljust(width - 12)} #{duration}"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
if entry.annotation
|
|
27
27
|
annotation_line = " \u21b3 #{entry.annotation}"
|
|
28
|
-
lines <<
|
|
28
|
+
lines << Chamomile::Style.new.foreground(DIM).render(annotation_line)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
if entry.undo_command
|
|
32
32
|
undo_line = " \u21b3 Undo: #{entry.undo_command.join(' ')}"
|
|
33
|
-
lines <<
|
|
33
|
+
lines << Chamomile::Style.new.foreground(DIM).render(undo_line)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
lines.join("\n")
|
|
@@ -10,7 +10,7 @@ module LazyRails
|
|
|
10
10
|
if selected
|
|
11
11
|
ViewHelpers.selected_style.render(text.ljust(width))
|
|
12
12
|
else
|
|
13
|
-
|
|
13
|
+
Chamomile::Style.new.foreground(color).render(text)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ module LazyRails
|
|
|
22
22
|
lines << if entry.success?
|
|
23
23
|
"=> #{entry.result}"
|
|
24
24
|
else
|
|
25
|
-
|
|
25
|
+
Chamomile::Style.new.foreground("#ff6347").render("Error: #{entry.error}")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
lines << ""
|
|
@@ -10,7 +10,7 @@ module LazyRails
|
|
|
10
10
|
ViewHelpers.selected_style.render(text.ljust(width))
|
|
11
11
|
else
|
|
12
12
|
color = credential_file.exists ? "#04b575" : "#666666"
|
|
13
|
-
|
|
13
|
+
Chamomile::Style.new.foreground(color).render(text)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ module LazyRails
|
|
|
34
34
|
lines << ""
|
|
35
35
|
lines << content
|
|
36
36
|
lines << ""
|
|
37
|
-
warn_style =
|
|
37
|
+
warn_style = Chamomile::Style.new.foreground("#e5c07b")
|
|
38
38
|
lines << warn_style.render("\u26a0 Sensitive \u2014 press Escape to clear")
|
|
39
39
|
lines.join("\n")
|
|
40
40
|
end
|
|
@@ -11,7 +11,7 @@ module LazyRails
|
|
|
11
11
|
if selected
|
|
12
12
|
ViewHelpers.selected_style.render(text.ljust(width))
|
|
13
13
|
else
|
|
14
|
-
icon =
|
|
14
|
+
icon = Chamomile::Style.new.foreground(color).render(arrow)
|
|
15
15
|
"#{icon} #{migration.version} #{ViewHelpers.truncate(migration.name, width - 22)}"
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -65,7 +65,7 @@ module LazyRails
|
|
|
65
65
|
|
|
66
66
|
diffs.each do |d|
|
|
67
67
|
color = d.op == :add ? "#04b575" : "#ff6347"
|
|
68
|
-
lines <<
|
|
68
|
+
lines << Chamomile::Style.new.foreground(color).render(d.to_s)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
lines << ""
|
|
@@ -14,14 +14,14 @@ module LazyRails
|
|
|
14
14
|
|
|
15
15
|
def self.render(error_text, width:)
|
|
16
16
|
lines = []
|
|
17
|
-
lines <<
|
|
17
|
+
lines << Chamomile::Style.new.foreground("#ff6347").bold.render("Error")
|
|
18
18
|
lines << ("=" * [width - 4, 40].min)
|
|
19
19
|
lines << ""
|
|
20
20
|
lines << error_text
|
|
21
21
|
lines << ""
|
|
22
22
|
|
|
23
23
|
suggestion = detect_suggestion(error_text)
|
|
24
|
-
lines <<
|
|
24
|
+
lines << Chamomile::Style.new.foreground("#e5c07b").render("Suggestion: #{suggestion}") if suggestion
|
|
25
25
|
|
|
26
26
|
lines.join("\n")
|
|
27
27
|
end
|
|
@@ -30,13 +30,13 @@ module LazyRails
|
|
|
30
30
|
ViewHelpers.selected_style.render(text.ljust(width))
|
|
31
31
|
else
|
|
32
32
|
color = STATUS_COLORS.fetch(job.status, "#cccccc")
|
|
33
|
-
|
|
33
|
+
Chamomile::Style.new.foreground(color).render(text)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def self.render_detail(job, width:)
|
|
38
38
|
lines = []
|
|
39
|
-
lines <<
|
|
39
|
+
lines << Chamomile::Style.new.bold.render(job.class_name)
|
|
40
40
|
lines << ""
|
|
41
41
|
|
|
42
42
|
lines << "ID: #{job.id}"
|
|
@@ -64,7 +64,7 @@ module LazyRails
|
|
|
64
64
|
# Arguments
|
|
65
65
|
if job.arguments && !job.arguments.to_s.empty?
|
|
66
66
|
lines << ""
|
|
67
|
-
lines <<
|
|
67
|
+
lines << Chamomile::Style.new.bold.render("Arguments")
|
|
68
68
|
begin
|
|
69
69
|
parsed = job.arguments.is_a?(String) ? JSON.parse(job.arguments) : job.arguments
|
|
70
70
|
lines << JSON.pretty_generate(parsed)
|
|
@@ -76,13 +76,13 @@ module LazyRails
|
|
|
76
76
|
# Error details for failed jobs
|
|
77
77
|
if job.status == "failed"
|
|
78
78
|
lines << ""
|
|
79
|
-
lines <<
|
|
79
|
+
lines << Chamomile::Style.new.foreground("#ff6347").bold.render("Error")
|
|
80
80
|
lines << "#{job.error_class}: #{job.error_message}"
|
|
81
81
|
|
|
82
82
|
if job.backtrace.is_a?(Array) && !job.backtrace.empty?
|
|
83
83
|
lines << ""
|
|
84
|
-
lines <<
|
|
85
|
-
bt_style =
|
|
84
|
+
lines << Chamomile::Style.new.bold.render("Backtrace")
|
|
85
|
+
bt_style = Chamomile::Style.new.foreground("#666666")
|
|
86
86
|
job.backtrace.first(20).each do |bt_line|
|
|
87
87
|
lines << bt_style.render(" #{bt_line}")
|
|
88
88
|
end
|
|
@@ -29,7 +29,7 @@ module LazyRails
|
|
|
29
29
|
if selected
|
|
30
30
|
ViewHelpers.selected_style.render(text.ljust(width))
|
|
31
31
|
else
|
|
32
|
-
|
|
32
|
+
Chamomile::Style.new.foreground(color).render(text)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -49,7 +49,7 @@ module LazyRails
|
|
|
49
49
|
dur = sql[:duration_ms]
|
|
50
50
|
color = dur.to_f > 100 ? "#ff6347" : "#5b9bd5"
|
|
51
51
|
query_text = " #{sql[:query]} (#{dur}ms)"
|
|
52
|
-
lines <<
|
|
52
|
+
lines << Chamomile::Style.new.foreground(color).render(query_text)
|
|
53
53
|
end
|
|
54
54
|
lines << ""
|
|
55
55
|
end
|
|
@@ -31,7 +31,7 @@ module LazyRails
|
|
|
31
31
|
lines << ""
|
|
32
32
|
|
|
33
33
|
if content[:error]
|
|
34
|
-
lines <<
|
|
34
|
+
lines << Chamomile::Style.new.foreground("#ff6347").render("Error: #{content[:error]}")
|
|
35
35
|
return lines.join("\n")
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -46,7 +46,7 @@ module LazyRails
|
|
|
46
46
|
color = ARROW_COLORS[color_key] || "#999999"
|
|
47
47
|
|
|
48
48
|
arrow_text = "#{macro_label} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2192 #{a.class_name}"
|
|
49
|
-
styled_arrow =
|
|
49
|
+
styled_arrow = Chamomile::Style.new.foreground(color).render(arrow_text)
|
|
50
50
|
lines << " #{connector}\u2500\u2500 #{styled_arrow}"
|
|
51
51
|
end
|
|
52
52
|
lines << ""
|
|
@@ -11,7 +11,7 @@ module LazyRails
|
|
|
11
11
|
else
|
|
12
12
|
desc_width = [width - name_text.length - 3, 0].max
|
|
13
13
|
dimmed_desc = if desc_width.positive?
|
|
14
|
-
|
|
14
|
+
Chamomile::Style.new.foreground("#666666").render(ViewHelpers.truncate(desc,
|
|
15
15
|
desc_width))
|
|
16
16
|
else
|
|
17
17
|
""
|
|
@@ -18,7 +18,7 @@ module LazyRails
|
|
|
18
18
|
if selected
|
|
19
19
|
ViewHelpers.selected_style.render("#{verb} #{path}".ljust(width))
|
|
20
20
|
else
|
|
21
|
-
styled_verb =
|
|
21
|
+
styled_verb = Chamomile::Style.new.foreground(VERB_COLORS[route.verb] || "#999999").render(verb)
|
|
22
22
|
"#{styled_verb} #{path}"
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -90,9 +90,9 @@ module LazyRails
|
|
|
90
90
|
|
|
91
91
|
footer = "Enter continue | ! don't show again | #{scroll_hint}".strip
|
|
92
92
|
|
|
93
|
-
box =
|
|
93
|
+
box = Chamomile::Style.new
|
|
94
94
|
.width(box_width)
|
|
95
|
-
.border(
|
|
95
|
+
.border(Chamomile::Border::ROUNDED)
|
|
96
96
|
.border_foreground("#b48ead")
|
|
97
97
|
.padding(0, 1)
|
|
98
98
|
.render("#{content}\n\n#{footer}")
|
|
@@ -100,7 +100,7 @@ module LazyRails
|
|
|
100
100
|
box_lines = box.lines
|
|
101
101
|
if box_lines.any?
|
|
102
102
|
title_text = " LazyRails "
|
|
103
|
-
title_styled =
|
|
103
|
+
title_styled = Chamomile::Style.new.foreground("#b48ead").bold.render(title_text)
|
|
104
104
|
box_lines[0] = ViewHelpers.inject_title(box_lines[0], title_styled, title_text.length)
|
|
105
105
|
end
|
|
106
106
|
|
data/lib/lazyrails.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lazyrails-tui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jack Killilea
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chamomile
|
|
@@ -16,42 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0
|
|
19
|
+
version: '1.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: chamomile-flourish
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.2'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0.2'
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: chamomile-petals
|
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0.2'
|
|
48
|
-
type: :runtime
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - "~>"
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0.2'
|
|
26
|
+
version: '1.0'
|
|
55
27
|
description: LazyRails gives Rails developers a fast, navigable TUI that surfaces
|
|
56
28
|
everything the Rails CLI offers in a single split-pane interface.
|
|
57
29
|
email:
|