r2ui 0.1.0 → 0.2.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/CHANGELOG.md +64 -0
- data/README.md +79 -0
- data/lib/r2ui/app.rb +311 -34
- data/lib/r2ui/canvas.rb +135 -14
- data/lib/r2ui/cli/builder.rb +72 -0
- data/lib/r2ui/cli/context.rb +45 -0
- data/lib/r2ui/cli/definition.rb +174 -0
- data/lib/r2ui/cli/ext/ask.rb +133 -0
- data/lib/r2ui/cli/ext/box.rb +112 -0
- data/lib/r2ui/cli/ext/choose.rb +162 -0
- data/lib/r2ui/cli/ext/choose_many.rb +241 -0
- data/lib/r2ui/cli/ext/color_option.rb +64 -0
- data/lib/r2ui/cli/ext/completion.rb +520 -0
- data/lib/r2ui/cli/ext/config.rb +179 -0
- data/lib/r2ui/cli/ext/confirm.rb +110 -0
- data/lib/r2ui/cli/ext/dashboard.rb +105 -0
- data/lib/r2ui/cli/ext/diff.rb +195 -0
- data/lib/r2ui/cli/ext/editor.rb +94 -0
- data/lib/r2ui/cli/ext/env.rb +108 -0
- data/lib/r2ui/cli/ext/examples.rb +62 -0
- data/lib/r2ui/cli/ext/filter.rb +269 -0
- data/lib/r2ui/cli/ext/format.rb +104 -0
- data/lib/r2ui/cli/ext/list.rb +117 -0
- data/lib/r2ui/cli/ext/log.rb +89 -0
- data/lib/r2ui/cli/ext/pager.rb +97 -0
- data/lib/r2ui/cli/ext/pairs.rb +62 -0
- data/lib/r2ui/cli/ext/parallel.rb +274 -0
- data/lib/r2ui/cli/ext/password.rb +158 -0
- data/lib/r2ui/cli/ext/progress.rb +330 -0
- data/lib/r2ui/cli/ext/reference.rb +129 -0
- data/lib/r2ui/cli/ext/spinner.rb +165 -0
- data/lib/r2ui/cli/ext/summary.rb +63 -0
- data/lib/r2ui/cli/ext/table.rb +141 -0
- data/lib/r2ui/cli/ext/tasks.rb +216 -0
- data/lib/r2ui/cli/ext/trace.rb +64 -0
- data/lib/r2ui/cli/ext/tree.rb +114 -0
- data/lib/r2ui/cli/ext/version.rb +67 -0
- data/lib/r2ui/cli/extension.rb +129 -0
- data/lib/r2ui/cli/help.rb +115 -0
- data/lib/r2ui/cli/helpers.rb +20 -0
- data/lib/r2ui/cli/live.rb +150 -0
- data/lib/r2ui/cli/parser.rb +165 -0
- data/lib/r2ui/cli/prompt.rb +133 -0
- data/lib/r2ui/cli/runner.rb +86 -0
- data/lib/r2ui/cli/shell.rb +185 -0
- data/lib/r2ui/cli/testing.rb +49 -0
- data/lib/r2ui/cli.rb +129 -0
- data/lib/r2ui/compat/bubbletea/LICENSE-bubbletea.txt +21 -0
- data/lib/r2ui/compat/bubbletea/ansi.rb +424 -0
- data/lib/r2ui/compat/bubbletea/commands.rb +143 -0
- data/lib/r2ui/compat/bubbletea/input.rb +269 -0
- data/lib/r2ui/compat/bubbletea/input_reader.rb +66 -0
- data/lib/r2ui/compat/bubbletea/messages.rb +251 -0
- data/lib/r2ui/compat/bubbletea/model.rb +65 -0
- data/lib/r2ui/compat/bubbletea/native.rb +254 -0
- data/lib/r2ui/compat/bubbletea/renderer.rb +192 -0
- data/lib/r2ui/compat/bubbletea/runner.rb +425 -0
- data/lib/r2ui/compat/bubbletea/terminal.rb +230 -0
- data/lib/r2ui/compat/bubbletea/version.rb +8 -0
- data/lib/r2ui/compat/bubbletea/width_table.rb +228 -0
- data/lib/r2ui/compat/bubbletea.rb +16 -0
- data/lib/r2ui/compat/lipgloss/border.rb +17 -0
- data/lib/r2ui/compat/lipgloss/color.rb +78 -0
- data/lib/r2ui/compat/lipgloss/color_blend.rb +166 -0
- data/lib/r2ui/compat/lipgloss/colorful.rb +585 -0
- data/lib/r2ui/compat/lipgloss/layout.rb +461 -0
- data/lib/r2ui/compat/lipgloss/list.rb +85 -0
- data/lib/r2ui/compat/lipgloss/position.rb +30 -0
- data/lib/r2ui/compat/lipgloss/style/border.rb +134 -0
- data/lib/r2ui/compat/lipgloss/style.rb +1062 -0
- data/lib/r2ui/compat/lipgloss/table/render.rb +518 -0
- data/lib/r2ui/compat/lipgloss/table.rb +185 -0
- data/lib/r2ui/compat/lipgloss/termenv.rb +768 -0
- data/lib/r2ui/compat/lipgloss/text/unicode_tables.rb +428 -0
- data/lib/r2ui/compat/lipgloss/text.rb +1555 -0
- data/lib/r2ui/compat/lipgloss/tree/go_tree.rb +243 -0
- data/lib/r2ui/compat/lipgloss/tree.rb +105 -0
- data/lib/r2ui/compat/lipgloss/version.rb +15 -0
- data/lib/r2ui/compat/lipgloss.rb +64 -0
- data/lib/r2ui/compat/load_path/bubbletea.rb +4 -0
- data/lib/r2ui/compat/load_path/lipgloss.rb +4 -0
- data/lib/r2ui/component.rb +67 -0
- data/lib/r2ui/context.rb +87 -0
- data/lib/r2ui/drop_in.rb +16 -0
- data/lib/r2ui/dsl/column.rb +11 -3
- data/lib/r2ui/dsl/dashboard.rb +45 -9
- data/lib/r2ui/dsl/resource.rb +12 -0
- data/lib/r2ui/ext/after.rb +54 -0
- data/lib/r2ui/ext/async.rb +81 -0
- data/lib/r2ui/ext/batch_sequence.rb +54 -0
- data/lib/r2ui/ext/countdown.rb +52 -0
- data/lib/r2ui/ext/data_table.rb +71 -0
- data/lib/r2ui/ext/every.rb +66 -0
- data/lib/r2ui/ext/exec.rb +116 -0
- data/lib/r2ui/ext/file_picker.rb +78 -0
- data/lib/r2ui/ext/focus_report.rb +69 -0
- data/lib/r2ui/ext/help.rb +62 -0
- data/lib/r2ui/ext/keys.rb +64 -0
- data/lib/r2ui/ext/list.rb +145 -0
- data/lib/r2ui/ext/messages.rb +87 -0
- data/lib/r2ui/ext/mouse.rb +134 -0
- data/lib/r2ui/ext/paginator.rb +86 -0
- data/lib/r2ui/ext/paste.rb +86 -0
- data/lib/r2ui/ext/println.rb +21 -0
- data/lib/r2ui/ext/progress.rb +85 -0
- data/lib/r2ui/ext/refresh.rb +56 -0
- data/lib/r2ui/ext/resize.rb +62 -0
- data/lib/r2ui/ext/screen.rb +47 -0
- data/lib/r2ui/ext/screen_mode.rb +63 -0
- data/lib/r2ui/ext/spinner.rb +59 -0
- data/lib/r2ui/ext/state.rb +45 -0
- data/lib/r2ui/ext/stopwatch.rb +67 -0
- data/lib/r2ui/ext/suspend.rb +56 -0
- data/lib/r2ui/ext/text_area.rb +73 -0
- data/lib/r2ui/ext/text_input.rb +83 -0
- data/lib/r2ui/ext/theme.rb +112 -0
- data/lib/r2ui/ext/view.rb +37 -0
- data/lib/r2ui/ext/viewport.rb +92 -0
- data/lib/r2ui/ext/window_title.rb +51 -0
- data/lib/r2ui/extension.rb +199 -0
- data/lib/r2ui/history.rb +4 -1
- data/lib/r2ui/keys.rb +35 -8
- data/lib/r2ui/motion.rb +169 -0
- data/lib/r2ui/panel_state.rb +46 -2
- data/lib/r2ui/renderer.rb +87 -22
- data/lib/r2ui/version.rb +1 -1
- data/lib/r2ui/widgets/box.rb +6 -3
- data/lib/r2ui/widgets/glyphs.rb +149 -0
- data/lib/r2ui/widgets/table.rb +109 -25
- data/lib/r2ui.rb +12 -1
- metadata +119 -4
- data/lib/r2ui/terminal.rb +0 -53
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: r2ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Gavin
|
|
@@ -18,29 +18,144 @@ executables:
|
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
|
20
20
|
files:
|
|
21
|
+
- CHANGELOG.md
|
|
21
22
|
- LICENSE.txt
|
|
22
23
|
- README.md
|
|
23
24
|
- exe/r2ui
|
|
24
25
|
- lib/r2ui.rb
|
|
25
26
|
- lib/r2ui/app.rb
|
|
26
27
|
- lib/r2ui/canvas.rb
|
|
28
|
+
- lib/r2ui/cli.rb
|
|
29
|
+
- lib/r2ui/cli/builder.rb
|
|
30
|
+
- lib/r2ui/cli/context.rb
|
|
31
|
+
- lib/r2ui/cli/definition.rb
|
|
32
|
+
- lib/r2ui/cli/ext/ask.rb
|
|
33
|
+
- lib/r2ui/cli/ext/box.rb
|
|
34
|
+
- lib/r2ui/cli/ext/choose.rb
|
|
35
|
+
- lib/r2ui/cli/ext/choose_many.rb
|
|
36
|
+
- lib/r2ui/cli/ext/color_option.rb
|
|
37
|
+
- lib/r2ui/cli/ext/completion.rb
|
|
38
|
+
- lib/r2ui/cli/ext/config.rb
|
|
39
|
+
- lib/r2ui/cli/ext/confirm.rb
|
|
40
|
+
- lib/r2ui/cli/ext/dashboard.rb
|
|
41
|
+
- lib/r2ui/cli/ext/diff.rb
|
|
42
|
+
- lib/r2ui/cli/ext/editor.rb
|
|
43
|
+
- lib/r2ui/cli/ext/env.rb
|
|
44
|
+
- lib/r2ui/cli/ext/examples.rb
|
|
45
|
+
- lib/r2ui/cli/ext/filter.rb
|
|
46
|
+
- lib/r2ui/cli/ext/format.rb
|
|
47
|
+
- lib/r2ui/cli/ext/list.rb
|
|
48
|
+
- lib/r2ui/cli/ext/log.rb
|
|
49
|
+
- lib/r2ui/cli/ext/pager.rb
|
|
50
|
+
- lib/r2ui/cli/ext/pairs.rb
|
|
51
|
+
- lib/r2ui/cli/ext/parallel.rb
|
|
52
|
+
- lib/r2ui/cli/ext/password.rb
|
|
53
|
+
- lib/r2ui/cli/ext/progress.rb
|
|
54
|
+
- lib/r2ui/cli/ext/reference.rb
|
|
55
|
+
- lib/r2ui/cli/ext/spinner.rb
|
|
56
|
+
- lib/r2ui/cli/ext/summary.rb
|
|
57
|
+
- lib/r2ui/cli/ext/table.rb
|
|
58
|
+
- lib/r2ui/cli/ext/tasks.rb
|
|
59
|
+
- lib/r2ui/cli/ext/trace.rb
|
|
60
|
+
- lib/r2ui/cli/ext/tree.rb
|
|
61
|
+
- lib/r2ui/cli/ext/version.rb
|
|
62
|
+
- lib/r2ui/cli/extension.rb
|
|
63
|
+
- lib/r2ui/cli/help.rb
|
|
64
|
+
- lib/r2ui/cli/helpers.rb
|
|
65
|
+
- lib/r2ui/cli/live.rb
|
|
66
|
+
- lib/r2ui/cli/parser.rb
|
|
67
|
+
- lib/r2ui/cli/prompt.rb
|
|
68
|
+
- lib/r2ui/cli/runner.rb
|
|
69
|
+
- lib/r2ui/cli/shell.rb
|
|
70
|
+
- lib/r2ui/cli/testing.rb
|
|
71
|
+
- lib/r2ui/compat/bubbletea.rb
|
|
72
|
+
- lib/r2ui/compat/bubbletea/LICENSE-bubbletea.txt
|
|
73
|
+
- lib/r2ui/compat/bubbletea/ansi.rb
|
|
74
|
+
- lib/r2ui/compat/bubbletea/commands.rb
|
|
75
|
+
- lib/r2ui/compat/bubbletea/input.rb
|
|
76
|
+
- lib/r2ui/compat/bubbletea/input_reader.rb
|
|
77
|
+
- lib/r2ui/compat/bubbletea/messages.rb
|
|
78
|
+
- lib/r2ui/compat/bubbletea/model.rb
|
|
79
|
+
- lib/r2ui/compat/bubbletea/native.rb
|
|
80
|
+
- lib/r2ui/compat/bubbletea/renderer.rb
|
|
81
|
+
- lib/r2ui/compat/bubbletea/runner.rb
|
|
82
|
+
- lib/r2ui/compat/bubbletea/terminal.rb
|
|
83
|
+
- lib/r2ui/compat/bubbletea/version.rb
|
|
84
|
+
- lib/r2ui/compat/bubbletea/width_table.rb
|
|
85
|
+
- lib/r2ui/compat/lipgloss.rb
|
|
86
|
+
- lib/r2ui/compat/lipgloss/border.rb
|
|
87
|
+
- lib/r2ui/compat/lipgloss/color.rb
|
|
88
|
+
- lib/r2ui/compat/lipgloss/color_blend.rb
|
|
89
|
+
- lib/r2ui/compat/lipgloss/colorful.rb
|
|
90
|
+
- lib/r2ui/compat/lipgloss/layout.rb
|
|
91
|
+
- lib/r2ui/compat/lipgloss/list.rb
|
|
92
|
+
- lib/r2ui/compat/lipgloss/position.rb
|
|
93
|
+
- lib/r2ui/compat/lipgloss/style.rb
|
|
94
|
+
- lib/r2ui/compat/lipgloss/style/border.rb
|
|
95
|
+
- lib/r2ui/compat/lipgloss/table.rb
|
|
96
|
+
- lib/r2ui/compat/lipgloss/table/render.rb
|
|
97
|
+
- lib/r2ui/compat/lipgloss/termenv.rb
|
|
98
|
+
- lib/r2ui/compat/lipgloss/text.rb
|
|
99
|
+
- lib/r2ui/compat/lipgloss/text/unicode_tables.rb
|
|
100
|
+
- lib/r2ui/compat/lipgloss/tree.rb
|
|
101
|
+
- lib/r2ui/compat/lipgloss/tree/go_tree.rb
|
|
102
|
+
- lib/r2ui/compat/lipgloss/version.rb
|
|
103
|
+
- lib/r2ui/compat/load_path/bubbletea.rb
|
|
104
|
+
- lib/r2ui/compat/load_path/lipgloss.rb
|
|
105
|
+
- lib/r2ui/component.rb
|
|
106
|
+
- lib/r2ui/context.rb
|
|
107
|
+
- lib/r2ui/drop_in.rb
|
|
27
108
|
- lib/r2ui/dsl/column.rb
|
|
28
109
|
- lib/r2ui/dsl/dashboard.rb
|
|
29
110
|
- lib/r2ui/dsl/resource.rb
|
|
111
|
+
- lib/r2ui/ext/after.rb
|
|
112
|
+
- lib/r2ui/ext/async.rb
|
|
113
|
+
- lib/r2ui/ext/batch_sequence.rb
|
|
114
|
+
- lib/r2ui/ext/countdown.rb
|
|
115
|
+
- lib/r2ui/ext/data_table.rb
|
|
116
|
+
- lib/r2ui/ext/every.rb
|
|
117
|
+
- lib/r2ui/ext/exec.rb
|
|
118
|
+
- lib/r2ui/ext/file_picker.rb
|
|
119
|
+
- lib/r2ui/ext/focus_report.rb
|
|
120
|
+
- lib/r2ui/ext/help.rb
|
|
121
|
+
- lib/r2ui/ext/keys.rb
|
|
122
|
+
- lib/r2ui/ext/list.rb
|
|
123
|
+
- lib/r2ui/ext/messages.rb
|
|
124
|
+
- lib/r2ui/ext/mouse.rb
|
|
125
|
+
- lib/r2ui/ext/paginator.rb
|
|
126
|
+
- lib/r2ui/ext/paste.rb
|
|
127
|
+
- lib/r2ui/ext/println.rb
|
|
128
|
+
- lib/r2ui/ext/progress.rb
|
|
129
|
+
- lib/r2ui/ext/refresh.rb
|
|
130
|
+
- lib/r2ui/ext/resize.rb
|
|
131
|
+
- lib/r2ui/ext/screen.rb
|
|
132
|
+
- lib/r2ui/ext/screen_mode.rb
|
|
133
|
+
- lib/r2ui/ext/spinner.rb
|
|
134
|
+
- lib/r2ui/ext/state.rb
|
|
135
|
+
- lib/r2ui/ext/stopwatch.rb
|
|
136
|
+
- lib/r2ui/ext/suspend.rb
|
|
137
|
+
- lib/r2ui/ext/text_area.rb
|
|
138
|
+
- lib/r2ui/ext/text_input.rb
|
|
139
|
+
- lib/r2ui/ext/theme.rb
|
|
140
|
+
- lib/r2ui/ext/view.rb
|
|
141
|
+
- lib/r2ui/ext/viewport.rb
|
|
142
|
+
- lib/r2ui/ext/window_title.rb
|
|
143
|
+
- lib/r2ui/extension.rb
|
|
30
144
|
- lib/r2ui/feed.rb
|
|
31
145
|
- lib/r2ui/format.rb
|
|
32
146
|
- lib/r2ui/history.rb
|
|
33
147
|
- lib/r2ui/keys.rb
|
|
148
|
+
- lib/r2ui/motion.rb
|
|
34
149
|
- lib/r2ui/panel_state.rb
|
|
35
150
|
- lib/r2ui/query.rb
|
|
36
151
|
- lib/r2ui/registry.rb
|
|
37
152
|
- lib/r2ui/renderer.rb
|
|
38
153
|
- lib/r2ui/search.rb
|
|
39
|
-
- lib/r2ui/terminal.rb
|
|
40
154
|
- lib/r2ui/value.rb
|
|
41
155
|
- lib/r2ui/version.rb
|
|
42
156
|
- lib/r2ui/widgets/box.rb
|
|
43
157
|
- lib/r2ui/widgets/gauge.rb
|
|
158
|
+
- lib/r2ui/widgets/glyphs.rb
|
|
44
159
|
- lib/r2ui/widgets/sparkline.rb
|
|
45
160
|
- lib/r2ui/widgets/stat.rb
|
|
46
161
|
- lib/r2ui/widgets/table.rb
|
|
@@ -49,7 +164,7 @@ licenses:
|
|
|
49
164
|
- MIT
|
|
50
165
|
metadata:
|
|
51
166
|
source_code_uri: https://github.com/satoramoto/r2ui
|
|
52
|
-
changelog_uri: https://github.com/satoramoto/r2ui/
|
|
167
|
+
changelog_uri: https://github.com/satoramoto/r2ui/blob/main/CHANGELOG.md
|
|
53
168
|
rdoc_options: []
|
|
54
169
|
require_paths:
|
|
55
170
|
- lib
|
|
@@ -64,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
64
179
|
- !ruby/object:Gem::Version
|
|
65
180
|
version: '0'
|
|
66
181
|
requirements: []
|
|
67
|
-
rubygems_version: 3.
|
|
182
|
+
rubygems_version: 3.6.9
|
|
68
183
|
specification_version: 4
|
|
69
184
|
summary: ActiveAdmin-style DSL for terminal dashboards
|
|
70
185
|
test_files: []
|
data/lib/r2ui/terminal.rb
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "io/console"
|
|
4
|
-
|
|
5
|
-
module R2UI
|
|
6
|
-
# Raw mode, alternate screen, line-diffed redraws. Always restores the terminal on exit.
|
|
7
|
-
class Terminal
|
|
8
|
-
def initialize(input: $stdin, output: $stdout)
|
|
9
|
-
@in = input
|
|
10
|
-
@out = output
|
|
11
|
-
@previous = []
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def open
|
|
15
|
-
@in.raw!
|
|
16
|
-
@out.write("\e[?1049h\e[?25l\e[2J")
|
|
17
|
-
@out.flush
|
|
18
|
-
yield self
|
|
19
|
-
ensure
|
|
20
|
-
@out.write("\e[0m\e[?25h\e[?1049l")
|
|
21
|
-
@out.flush
|
|
22
|
-
@in.cooked!
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def size
|
|
26
|
-
rows, cols = @out.winsize
|
|
27
|
-
[cols, rows]
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def clear = @previous = []
|
|
31
|
-
|
|
32
|
-
def draw(canvas)
|
|
33
|
-
out = +""
|
|
34
|
-
lines = canvas.ansi_lines
|
|
35
|
-
lines.each_with_index do |line, y|
|
|
36
|
-
next if @previous[y] == line
|
|
37
|
-
|
|
38
|
-
out << "\e[#{y + 1};1H" << line
|
|
39
|
-
end
|
|
40
|
-
@previous = lines
|
|
41
|
-
@out.write(out)
|
|
42
|
-
@out.flush
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Key names typed within `timeout` seconds (empty if none).
|
|
46
|
-
def read_keys(timeout)
|
|
47
|
-
return [] unless @in.wait_readable(timeout)
|
|
48
|
-
|
|
49
|
-
data = @in.read_nonblock(64, exception: false)
|
|
50
|
-
data.is_a?(String) ? Keys.parse(data) : []
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|