greeenboii 0.1.5 → 0.1.7
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/.idea/dataSources.local.xml +1 -1
- data/.idea/greeenboii.iml +0 -2
- data/.idea/vcs.xml +1 -0
- data/.idea/workspace.xml +154 -123
- data/.rubocop.sorbet.yml +5 -0
- data/.rubocop.yml +36 -0
- data/README.md +5 -0
- data/exe/greeenboii +1 -1
- data/lib/greeenboii/version.rb +5 -5
- data/lib/greeenboii.rb +447 -234
- data/sig/greeenboii/todo_list.rbs +30 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.9.rbi +9 -0
- data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
- data/sorbet/rbi/gems/console_table@0.3.1.rbi +78 -0
- data/sorbet/rbi/gems/csv@3.3.2.rbi +9 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/httparty@0.22.0.rbi +2115 -0
- data/sorbet/rbi/gems/json@2.10.1.rbi +2120 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.4.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +86 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
- data/sorbet/rbi/gems/minitest@5.25.4.rbi +1547 -0
- data/sorbet/rbi/gems/multi_xml@0.7.1.rbi +9 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/nokogiri@1.18.3.rbi +8205 -0
- data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.7.1.rbi +5525 -0
- data/sorbet/rbi/gems/prism@1.3.0.rbi +41403 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +164 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake-compiler@1.2.9.rbi +9 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
- data/sorbet/rbi/gems/rbi@0.2.4.rbi +4542 -0
- data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3795 -0
- data/sorbet/rbi/gems/rubocop-ast@1.38.0.rbi +7654 -0
- data/sorbet/rbi/gems/rubocop@1.72.2.rbi +61026 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/spoom@1.5.4.rbi +5026 -0
- data/sorbet/rbi/gems/sqlite3@2.6.0.rbi +1895 -0
- data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3656 -0
- data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +132 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +251 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18379 -0
- data/sorbet/tapioca/require.rb +6 -0
- metadata +47 -8
@@ -0,0 +1,3181 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `cli-ui` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem cli-ui`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://cli-ui//lib/cli/ui.rb#8
|
9
|
+
module CLI; end
|
10
|
+
|
11
|
+
# source://cli-ui//lib/cli/ui.rb#9
|
12
|
+
module CLI::UI
|
13
|
+
class << self
|
14
|
+
# Convenience Method for +CLI::UI::Prompt.any_key+
|
15
|
+
#
|
16
|
+
# ==== Attributes
|
17
|
+
#
|
18
|
+
# * +prompt+ - prompt to present
|
19
|
+
#
|
20
|
+
# source://cli-ui//lib/cli/ui.rb#101
|
21
|
+
sig { params(prompt: ::String).returns(T.nilable(::String)) }
|
22
|
+
def any_key(prompt = T.unsafe(nil)); end
|
23
|
+
|
24
|
+
# Convenience Method for +CLI::UI::Prompt.ask+
|
25
|
+
#
|
26
|
+
# source://cli-ui//lib/cli/ui.rb#119
|
27
|
+
sig do
|
28
|
+
params(
|
29
|
+
question: ::String,
|
30
|
+
options: T.nilable(T::Array[::String]),
|
31
|
+
default: T.nilable(T.any(::String, T::Array[::String])),
|
32
|
+
is_file: T::Boolean,
|
33
|
+
allow_empty: T::Boolean,
|
34
|
+
multiple: T::Boolean,
|
35
|
+
filter_ui: T::Boolean,
|
36
|
+
select_ui: T::Boolean,
|
37
|
+
options_proc: T.nilable(T.proc.params(handler: ::CLI::UI::Prompt::OptionsHandler).void)
|
38
|
+
).returns(T.any(::String, T::Array[::String]))
|
39
|
+
end
|
40
|
+
def ask(question, options: T.unsafe(nil), default: T.unsafe(nil), is_file: T.unsafe(nil), allow_empty: T.unsafe(nil), multiple: T.unsafe(nil), filter_ui: T.unsafe(nil), select_ui: T.unsafe(nil), &options_proc); end
|
41
|
+
|
42
|
+
# Convenience Method for +CLI::UI::Prompt.confirm+
|
43
|
+
#
|
44
|
+
# ==== Attributes
|
45
|
+
#
|
46
|
+
# * +question+ - question to confirm
|
47
|
+
#
|
48
|
+
# source://cli-ui//lib/cli/ui.rb#90
|
49
|
+
sig { params(question: ::String, default: T::Boolean).returns(T::Boolean) }
|
50
|
+
def confirm(question, default: T.unsafe(nil)); end
|
51
|
+
|
52
|
+
# Turn colour in Formatter, Frame, and Spinner output on or off.
|
53
|
+
#
|
54
|
+
# ==== Attributes
|
55
|
+
#
|
56
|
+
# * +bool+ - true or false; enable or disable colour.
|
57
|
+
#
|
58
|
+
# source://cli-ui//lib/cli/ui.rb#358
|
59
|
+
sig { params(bool: T::Boolean).void }
|
60
|
+
def enable_color=(bool); end
|
61
|
+
|
62
|
+
# Check whether colour is enabled in Formatter, Frame, and Spinner output.
|
63
|
+
# By default, colour is enabled when STDOUT is a TTY; that is, when output
|
64
|
+
# has not been directed to another program or to a file.
|
65
|
+
#
|
66
|
+
# source://cli-ui//lib/cli/ui.rb#347
|
67
|
+
sig { returns(T::Boolean) }
|
68
|
+
def enable_color?; end
|
69
|
+
|
70
|
+
# Turn cursor control in Formatter, Frame, and Spinner output on or off.
|
71
|
+
#
|
72
|
+
# ==== Attributes
|
73
|
+
#
|
74
|
+
# * +bool+ - true or false; enable or disable cursor control.
|
75
|
+
#
|
76
|
+
# source://cli-ui//lib/cli/ui.rb#378
|
77
|
+
sig { params(bool: T::Boolean).void }
|
78
|
+
def enable_cursor=(bool); end
|
79
|
+
|
80
|
+
# Check whether cursor control is enabled in Formatter, Frame, and Spinner output.
|
81
|
+
# By default, cursor control is enabled when STDOUT is a TTY; that is, when output
|
82
|
+
# has not been directed to another program or to a file.
|
83
|
+
#
|
84
|
+
# source://cli-ui//lib/cli/ui.rb#367
|
85
|
+
sig { returns(T::Boolean) }
|
86
|
+
def enable_cursor?; end
|
87
|
+
|
88
|
+
# Convenience Method to format text using +CLI::UI::Formatter.format+
|
89
|
+
# Check +CLI::UI::Formatter::SGR_MAP+ for available formatting options
|
90
|
+
#
|
91
|
+
# https://user-images.githubusercontent.com/3074765/33799827-6d0721a2-dd01-11e7-9ab5-c3d455264afe.png
|
92
|
+
# https://user-images.githubusercontent.com/3074765/33799847-9ec03fd0-dd01-11e7-93f7-5f5cc540e61e.png
|
93
|
+
#
|
94
|
+
# ==== Attributes
|
95
|
+
#
|
96
|
+
# * +input+ - input to format
|
97
|
+
#
|
98
|
+
# ==== Options
|
99
|
+
#
|
100
|
+
# * +enable_color+ - should color be used? default to true unless output is redirected.
|
101
|
+
#
|
102
|
+
# source://cli-ui//lib/cli/ui.rb#175
|
103
|
+
sig { params(input: ::String, enable_color: T::Boolean).returns(::String) }
|
104
|
+
def fmt(input, enable_color: T.unsafe(nil)); end
|
105
|
+
|
106
|
+
# Convenience Method for +CLI::UI::Frame.open+
|
107
|
+
#
|
108
|
+
# ==== Attributes
|
109
|
+
#
|
110
|
+
# * +args+ - arguments for +Frame.open+
|
111
|
+
# * +block+ - block for +Frame.open+
|
112
|
+
#
|
113
|
+
# source://cli-ui//lib/cli/ui.rb#241
|
114
|
+
sig do
|
115
|
+
type_parameters(:T)
|
116
|
+
.params(
|
117
|
+
text: ::String,
|
118
|
+
color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol)),
|
119
|
+
failure_text: T.nilable(::String),
|
120
|
+
success_text: T.nilable(::String),
|
121
|
+
timing: T.any(::Numeric, T::Boolean),
|
122
|
+
frame_style: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol),
|
123
|
+
to: T.any(::IO, ::StringIO),
|
124
|
+
block: T.nilable(T.proc.returns(T.type_parameter(:T)))
|
125
|
+
).returns(T.nilable(T.type_parameter(:T)))
|
126
|
+
end
|
127
|
+
def frame(text, color: T.unsafe(nil), failure_text: T.unsafe(nil), success_text: T.unsafe(nil), timing: T.unsafe(nil), frame_style: T.unsafe(nil), to: T.unsafe(nil), &block); end
|
128
|
+
|
129
|
+
# Set the default frame style.
|
130
|
+
# Convenience method for setting the default frame style with +CLI::UI::Frame.frame_style=+
|
131
|
+
#
|
132
|
+
# Raises ArgumentError if +frame_style+ is not valid
|
133
|
+
#
|
134
|
+
# ==== Attributes
|
135
|
+
#
|
136
|
+
# * +symbol+ - the default frame style to use for frames
|
137
|
+
#
|
138
|
+
# source://cli-ui//lib/cli/ui.rb#392
|
139
|
+
sig { params(frame_style: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)).void }
|
140
|
+
def frame_style=(frame_style); end
|
141
|
+
|
142
|
+
# Glyph resolution using +CLI::UI::Glyph.lookup+
|
143
|
+
# Look at the method signature for +Glyph.lookup+ for more details
|
144
|
+
#
|
145
|
+
# ==== Attributes
|
146
|
+
#
|
147
|
+
# * +handle+ - handle of the glyph to resolve
|
148
|
+
#
|
149
|
+
# source://cli-ui//lib/cli/ui.rb#46
|
150
|
+
sig { params(handle: ::String).returns(::CLI::UI::Glyph) }
|
151
|
+
def glyph(handle); end
|
152
|
+
|
153
|
+
# Create a terminal link
|
154
|
+
#
|
155
|
+
# source://cli-ui//lib/cli/ui.rb#398
|
156
|
+
sig { params(url: ::String, text: ::String, format: T::Boolean, blue_underline: T::Boolean).returns(::String) }
|
157
|
+
def link(url, text, format: T.unsafe(nil), blue_underline: T.unsafe(nil)); end
|
158
|
+
|
159
|
+
# Duplicate output to a file path
|
160
|
+
#
|
161
|
+
# ==== Attributes
|
162
|
+
#
|
163
|
+
# * +path+ - path to duplicate output to
|
164
|
+
#
|
165
|
+
# source://cli-ui//lib/cli/ui.rb#309
|
166
|
+
sig do
|
167
|
+
type_parameters(:T)
|
168
|
+
.params(
|
169
|
+
path: ::String,
|
170
|
+
block: T.proc.returns(T.type_parameter(:T))
|
171
|
+
).returns(T.type_parameter(:T))
|
172
|
+
end
|
173
|
+
def log_output_to(path, &block); end
|
174
|
+
|
175
|
+
# Convenience Method for +CLI::UI::Printer.puts+
|
176
|
+
#
|
177
|
+
# ==== Attributes
|
178
|
+
#
|
179
|
+
# * +msg+ - Message to print
|
180
|
+
# * +kwargs+ - keyword arguments for +Printer.puts+
|
181
|
+
#
|
182
|
+
# source://cli-ui//lib/cli/ui.rb#202
|
183
|
+
sig do
|
184
|
+
params(
|
185
|
+
msg: ::String,
|
186
|
+
frame_color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol)),
|
187
|
+
to: T.any(::IO, ::StringIO),
|
188
|
+
encoding: ::Encoding,
|
189
|
+
format: T::Boolean,
|
190
|
+
graceful: T::Boolean,
|
191
|
+
wrap: T::Boolean
|
192
|
+
).void
|
193
|
+
end
|
194
|
+
def puts(msg, frame_color: T.unsafe(nil), to: T.unsafe(nil), encoding: T.unsafe(nil), format: T.unsafe(nil), graceful: T.unsafe(nil), wrap: T.unsafe(nil)); end
|
195
|
+
|
196
|
+
# Disable all framing within a block
|
197
|
+
#
|
198
|
+
# ==== Attributes
|
199
|
+
#
|
200
|
+
# * +block+ - block in which to disable frames
|
201
|
+
#
|
202
|
+
# source://cli-ui//lib/cli/ui.rb#334
|
203
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
204
|
+
def raw(&block); end
|
205
|
+
|
206
|
+
# Color resolution using +CLI::UI::Color.lookup+
|
207
|
+
# Will lookup using +Color.lookup+ unless it's already a CLI::UI::Color (or nil)
|
208
|
+
#
|
209
|
+
# ==== Attributes
|
210
|
+
#
|
211
|
+
# * +input+ - color to resolve
|
212
|
+
#
|
213
|
+
# source://cli-ui//lib/cli/ui.rb#58
|
214
|
+
sig { params(input: T.any(::CLI::UI::Color, ::String, ::Symbol)).returns(::CLI::UI::Color) }
|
215
|
+
def resolve_color(input); end
|
216
|
+
|
217
|
+
# Frame style resolution using +CLI::UI::Frame::FrameStyle.lookup+.
|
218
|
+
# Will lookup using +FrameStyle.lookup+ unless it's already a CLI::UI::Frame::FrameStyle(or nil)
|
219
|
+
#
|
220
|
+
# ==== Attributes
|
221
|
+
#
|
222
|
+
# * +input+ - frame style to resolve
|
223
|
+
#
|
224
|
+
# source://cli-ui//lib/cli/ui.rb#74
|
225
|
+
sig do
|
226
|
+
params(
|
227
|
+
input: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)
|
228
|
+
).returns(::CLI::UI::Frame::FrameStyle)
|
229
|
+
end
|
230
|
+
def resolve_style(input); end
|
231
|
+
|
232
|
+
# Convenience Method to resolve text using +CLI::UI::Formatter.format+
|
233
|
+
# Check +CLI::UI::Formatter::SGR_MAP+ for available formatting options
|
234
|
+
#
|
235
|
+
# ==== Attributes
|
236
|
+
#
|
237
|
+
# * +input+ - input to format
|
238
|
+
# * +truncate_to+ - number of characters to truncate the string to (or nil)
|
239
|
+
# * +enable_color+ - should color be used? default to true unless output is redirected.
|
240
|
+
#
|
241
|
+
# source://cli-ui//lib/cli/ui.rb#153
|
242
|
+
sig { params(input: ::String, truncate_to: T.nilable(::Integer), enable_color: T::Boolean).returns(::String) }
|
243
|
+
def resolve_text(input, truncate_to: T.unsafe(nil), enable_color: T.unsafe(nil)); end
|
244
|
+
|
245
|
+
# Convenience Method for +CLI::UI::Spinner.spin+
|
246
|
+
#
|
247
|
+
# ==== Attributes
|
248
|
+
#
|
249
|
+
# * +args+ - arguments for +Spinner.open+
|
250
|
+
# * +block+ - block for +Spinner.open+
|
251
|
+
#
|
252
|
+
# source://cli-ui//lib/cli/ui.rb#278
|
253
|
+
sig do
|
254
|
+
params(
|
255
|
+
title: ::String,
|
256
|
+
auto_debrief: T::Boolean,
|
257
|
+
to: T.any(::IO, ::StringIO),
|
258
|
+
block: T.proc.params(task: ::CLI::UI::Spinner::SpinGroup::Task).void
|
259
|
+
).returns(T::Boolean)
|
260
|
+
end
|
261
|
+
def spinner(title, auto_debrief: T.unsafe(nil), to: T.unsafe(nil), &block); end
|
262
|
+
|
263
|
+
# Convenience Method to override frame color using +CLI::UI::Frame.with_frame_color+
|
264
|
+
#
|
265
|
+
# ==== Attributes
|
266
|
+
#
|
267
|
+
# * +color+ - color to override to
|
268
|
+
# * +block+ - block for +Frame.with_frame_color_override+
|
269
|
+
#
|
270
|
+
# source://cli-ui//lib/cli/ui.rb#294
|
271
|
+
sig do
|
272
|
+
type_parameters(:T)
|
273
|
+
.params(
|
274
|
+
color: T.any(::CLI::UI::Color, ::String, ::Symbol),
|
275
|
+
block: T.proc.returns(T.type_parameter(:T))
|
276
|
+
).returns(T.type_parameter(:T))
|
277
|
+
end
|
278
|
+
def with_frame_color(color, &block); end
|
279
|
+
|
280
|
+
# source://cli-ui//lib/cli/ui.rb#180
|
281
|
+
sig { params(input: ::String).returns(::String) }
|
282
|
+
def wrap(input); end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#8
|
287
|
+
module CLI::UI::ANSI
|
288
|
+
class << self
|
289
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#206
|
290
|
+
sig { returns(::String) }
|
291
|
+
def clear_to_end_of_line; end
|
292
|
+
|
293
|
+
# Returns an ANSI control sequence
|
294
|
+
#
|
295
|
+
# ==== Attributes
|
296
|
+
#
|
297
|
+
# - +args+ - Argument to pass to the ANSI control sequence
|
298
|
+
# - +cmd+ - ANSI control sequence Command
|
299
|
+
#
|
300
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#60
|
301
|
+
sig { params(args: ::String, cmd: ::String).returns(::String) }
|
302
|
+
def control(args, cmd); end
|
303
|
+
|
304
|
+
# Move the cursor back n columns
|
305
|
+
#
|
306
|
+
# ==== Attributes
|
307
|
+
#
|
308
|
+
# * +n+ - number of columns by which to move the cursor back
|
309
|
+
#
|
310
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#118
|
311
|
+
sig { params(n: ::Integer).returns(::String) }
|
312
|
+
def cursor_back(n = T.unsafe(nil)); end
|
313
|
+
|
314
|
+
# Move the cursor down n lines
|
315
|
+
#
|
316
|
+
# ==== Attributes
|
317
|
+
#
|
318
|
+
# * +n+ - number of lines by which to move the cursor down
|
319
|
+
#
|
320
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#92
|
321
|
+
sig { params(n: ::Integer).returns(::String) }
|
322
|
+
def cursor_down(n = T.unsafe(nil)); end
|
323
|
+
|
324
|
+
# Move the cursor forward n columns
|
325
|
+
#
|
326
|
+
# ==== Attributes
|
327
|
+
#
|
328
|
+
# * +n+ - number of columns by which to move the cursor forward
|
329
|
+
#
|
330
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#105
|
331
|
+
sig { params(n: ::Integer).returns(::String) }
|
332
|
+
def cursor_forward(n = T.unsafe(nil)); end
|
333
|
+
|
334
|
+
# Move the cursor to a specific column
|
335
|
+
#
|
336
|
+
# ==== Attributes
|
337
|
+
#
|
338
|
+
# * +n+ - The column to move to
|
339
|
+
#
|
340
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#131
|
341
|
+
sig { params(n: ::Integer).returns(::String) }
|
342
|
+
def cursor_horizontal_absolute(n = T.unsafe(nil)); end
|
343
|
+
|
344
|
+
# Restore the saved cursor position
|
345
|
+
#
|
346
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#176
|
347
|
+
sig { returns(::String) }
|
348
|
+
def cursor_restore; end
|
349
|
+
|
350
|
+
# Save the cursor position
|
351
|
+
#
|
352
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#169
|
353
|
+
sig { returns(::String) }
|
354
|
+
def cursor_save; end
|
355
|
+
|
356
|
+
# Move the cursor up n lines
|
357
|
+
#
|
358
|
+
# ==== Attributes
|
359
|
+
#
|
360
|
+
# * +n+ - number of lines by which to move the cursor up
|
361
|
+
#
|
362
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#79
|
363
|
+
sig { params(n: ::Integer).returns(::String) }
|
364
|
+
def cursor_up(n = T.unsafe(nil)); end
|
365
|
+
|
366
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#138
|
367
|
+
sig { returns(::String) }
|
368
|
+
def enter_alternate_screen; end
|
369
|
+
|
370
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#143
|
371
|
+
sig { returns(::String) }
|
372
|
+
def exit_alternate_screen; end
|
373
|
+
|
374
|
+
# Hide the cursor
|
375
|
+
#
|
376
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#162
|
377
|
+
sig { returns(::String) }
|
378
|
+
def hide_cursor; end
|
379
|
+
|
380
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#211
|
381
|
+
sig { returns(::String) }
|
382
|
+
def insert_line; end
|
383
|
+
|
384
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#216
|
385
|
+
sig { params(n: ::Integer).returns(::String) }
|
386
|
+
def insert_lines(n = T.unsafe(nil)); end
|
387
|
+
|
388
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#148
|
389
|
+
sig { returns(::Regexp) }
|
390
|
+
def match_alternate_screen; end
|
391
|
+
|
392
|
+
# Move to the next line
|
393
|
+
#
|
394
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#183
|
395
|
+
sig { returns(::String) }
|
396
|
+
def next_line; end
|
397
|
+
|
398
|
+
# Move to the previous line
|
399
|
+
#
|
400
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#190
|
401
|
+
sig { returns(::String) }
|
402
|
+
def previous_line; end
|
403
|
+
|
404
|
+
# Move to the previous n lines
|
405
|
+
#
|
406
|
+
# ==== Attributes
|
407
|
+
#
|
408
|
+
# * +n+ - number of lines by which to move the cursor up
|
409
|
+
#
|
410
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#201
|
411
|
+
sig { params(n: ::Integer).returns(::String) }
|
412
|
+
def previous_lines(n = T.unsafe(nil)); end
|
413
|
+
|
414
|
+
# ANSI escape sequences (like \x1b[31m) have zero width.
|
415
|
+
# when calculating the padding width, we must exclude them.
|
416
|
+
# This also implements a basic version of utf8 character width calculation like
|
417
|
+
# we could get for real from something like utf8proc.
|
418
|
+
#
|
419
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#22
|
420
|
+
sig { params(str: ::String).returns(::Integer) }
|
421
|
+
def printing_width(str); end
|
422
|
+
|
423
|
+
# https://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
424
|
+
#
|
425
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#66
|
426
|
+
sig { params(params: ::String).returns(::String) }
|
427
|
+
def sgr(params); end
|
428
|
+
|
429
|
+
# Show the cursor
|
430
|
+
#
|
431
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#155
|
432
|
+
sig { returns(::String) }
|
433
|
+
def show_cursor; end
|
434
|
+
|
435
|
+
# Strips ANSI codes from a str
|
436
|
+
#
|
437
|
+
# ==== Attributes
|
438
|
+
#
|
439
|
+
# - +str+ - The string from which to strip codes
|
440
|
+
#
|
441
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#48
|
442
|
+
sig { params(str: ::String).returns(::String) }
|
443
|
+
def strip_codes(str); end
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
# source://cli-ui//lib/cli/ui/ansi.rb#11
|
448
|
+
CLI::UI::ANSI::ESC = T.let(T.unsafe(nil), String)
|
449
|
+
|
450
|
+
# source://cli-ui//lib/cli/ui/color.rb#8
|
451
|
+
class CLI::UI::Color
|
452
|
+
# Creates a new color mapping
|
453
|
+
# Signatures can be found here:
|
454
|
+
# https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
455
|
+
#
|
456
|
+
# ==== Attributes
|
457
|
+
#
|
458
|
+
# * +sgr+ - The color signature
|
459
|
+
# * +name+ - The name of the color
|
460
|
+
#
|
461
|
+
# source://cli-ui//lib/cli/ui/color.rb#27
|
462
|
+
sig { params(sgr: ::String, name: ::Symbol).void }
|
463
|
+
def initialize(sgr, name); end
|
464
|
+
|
465
|
+
# @return [String]
|
466
|
+
#
|
467
|
+
# source://cli-ui//lib/cli/ui/color.rb#12
|
468
|
+
def code; end
|
469
|
+
|
470
|
+
# source://cli-ui//lib/cli/ui/color.rb#15
|
471
|
+
sig { returns(::Symbol) }
|
472
|
+
def name; end
|
473
|
+
|
474
|
+
# source://cli-ui//lib/cli/ui/color.rb#12
|
475
|
+
sig { returns(::String) }
|
476
|
+
def sgr; end
|
477
|
+
|
478
|
+
class << self
|
479
|
+
# All available colors by name
|
480
|
+
#
|
481
|
+
# source://cli-ui//lib/cli/ui/color.rb#100
|
482
|
+
sig { returns(T::Array[::Symbol]) }
|
483
|
+
def available; end
|
484
|
+
|
485
|
+
# Looks up a color code by name
|
486
|
+
#
|
487
|
+
# ==== Raises
|
488
|
+
# Raises a InvalidColorName if the color is not available
|
489
|
+
# You likely need to add it to the +MAP+ or you made a typo
|
490
|
+
#
|
491
|
+
# ==== Returns
|
492
|
+
# Returns a color code
|
493
|
+
#
|
494
|
+
# source://cli-ui//lib/cli/ui/color.rb#91
|
495
|
+
sig { params(name: T.any(::String, ::Symbol)).returns(::CLI::UI::Color) }
|
496
|
+
def lookup(name); end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
500
|
+
# default blue is low-contrast against black in some default terminal color scheme
|
501
|
+
#
|
502
|
+
# source://cli-ui//lib/cli/ui/color.rb#37
|
503
|
+
CLI::UI::Color::BLUE = T.let(T.unsafe(nil), CLI::UI::Color)
|
504
|
+
|
505
|
+
# source://cli-ui//lib/cli/ui/color.rb#41
|
506
|
+
CLI::UI::Color::BOLD = T.let(T.unsafe(nil), CLI::UI::Color)
|
507
|
+
|
508
|
+
# source://cli-ui//lib/cli/ui/color.rb#39
|
509
|
+
CLI::UI::Color::CYAN = T.let(T.unsafe(nil), CLI::UI::Color)
|
510
|
+
|
511
|
+
# 240 is very dark gray; 255 is very light gray. 244 is somewhat dark.
|
512
|
+
#
|
513
|
+
# source://cli-ui//lib/cli/ui/color.rb#45
|
514
|
+
CLI::UI::Color::GRAY = T.let(T.unsafe(nil), CLI::UI::Color)
|
515
|
+
|
516
|
+
# source://cli-ui//lib/cli/ui/color.rb#34
|
517
|
+
CLI::UI::Color::GREEN = T.let(T.unsafe(nil), CLI::UI::Color)
|
518
|
+
|
519
|
+
# source://cli-ui//lib/cli/ui/color.rb#61
|
520
|
+
class CLI::UI::Color::InvalidColorName < ::ArgumentError
|
521
|
+
# source://cli-ui//lib/cli/ui/color.rb#65
|
522
|
+
sig { params(name: ::Symbol).void }
|
523
|
+
def initialize(name); end
|
524
|
+
|
525
|
+
# source://cli-ui//lib/cli/ui/color.rb#71
|
526
|
+
sig { returns(::String) }
|
527
|
+
def message; end
|
528
|
+
end
|
529
|
+
|
530
|
+
# source://cli-ui//lib/cli/ui/color.rb#38
|
531
|
+
CLI::UI::Color::MAGENTA = T.let(T.unsafe(nil), CLI::UI::Color)
|
532
|
+
|
533
|
+
# source://cli-ui//lib/cli/ui/color.rb#49
|
534
|
+
CLI::UI::Color::MAP = T.let(T.unsafe(nil), Hash)
|
535
|
+
|
536
|
+
# Using color 214 from the 256-color palette for a more distinct orange
|
537
|
+
#
|
538
|
+
# source://cli-ui//lib/cli/ui/color.rb#47
|
539
|
+
CLI::UI::Color::ORANGE = T.let(T.unsafe(nil), CLI::UI::Color)
|
540
|
+
|
541
|
+
# source://cli-ui//lib/cli/ui/color.rb#33
|
542
|
+
CLI::UI::Color::RED = T.let(T.unsafe(nil), CLI::UI::Color)
|
543
|
+
|
544
|
+
# source://cli-ui//lib/cli/ui/color.rb#40
|
545
|
+
CLI::UI::Color::RESET = T.let(T.unsafe(nil), CLI::UI::Color)
|
546
|
+
|
547
|
+
# source://cli-ui//lib/cli/ui/color.rb#42
|
548
|
+
CLI::UI::Color::WHITE = T.let(T.unsafe(nil), CLI::UI::Color)
|
549
|
+
|
550
|
+
# source://cli-ui//lib/cli/ui/color.rb#35
|
551
|
+
CLI::UI::Color::YELLOW = T.let(T.unsafe(nil), CLI::UI::Color)
|
552
|
+
|
553
|
+
# source://cli-ui//lib/cli/ui.rb#31
|
554
|
+
CLI::UI::Colorable = T.type_alias { T.any(::CLI::UI::Color, ::String, ::Symbol) }
|
555
|
+
|
556
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#9
|
557
|
+
class CLI::UI::Formatter
|
558
|
+
# Initialize a formatter with text.
|
559
|
+
#
|
560
|
+
# ===== Attributes
|
561
|
+
#
|
562
|
+
# * +text+ - the text to format
|
563
|
+
#
|
564
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#87
|
565
|
+
sig { params(text: ::String).void }
|
566
|
+
def initialize(text); end
|
567
|
+
|
568
|
+
# Format the text using a map.
|
569
|
+
#
|
570
|
+
# ===== Attributes
|
571
|
+
#
|
572
|
+
# * +sgr_map+ - the mapping of the formattings. Defaults to +SGR_MAP+
|
573
|
+
#
|
574
|
+
# ===== Options
|
575
|
+
#
|
576
|
+
# * +:enable_color+ - enable color output? Default is true unless output is redirected
|
577
|
+
#
|
578
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#103
|
579
|
+
sig { params(sgr_map: T::Hash[::String, ::String], enable_color: T::Boolean).returns(::String) }
|
580
|
+
def format(sgr_map = T.unsafe(nil), enable_color: T.unsafe(nil)); end
|
581
|
+
|
582
|
+
private
|
583
|
+
|
584
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#129
|
585
|
+
sig do
|
586
|
+
params(
|
587
|
+
text: ::String,
|
588
|
+
fmt: T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)],
|
589
|
+
sgr_map: T::Hash[::String, ::String]
|
590
|
+
).returns(::String)
|
591
|
+
end
|
592
|
+
def apply_format(text, fmt, sgr_map); end
|
593
|
+
|
594
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#211
|
595
|
+
sig { params(text: ::String, stack: T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)]).void }
|
596
|
+
def emit(text, stack); end
|
597
|
+
|
598
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#191
|
599
|
+
sig do
|
600
|
+
params(
|
601
|
+
sc: ::StringScanner,
|
602
|
+
stack: T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)]
|
603
|
+
).returns(T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)])
|
604
|
+
end
|
605
|
+
def parse_body(sc, stack = T.unsafe(nil)); end
|
606
|
+
|
607
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#147
|
608
|
+
sig do
|
609
|
+
params(
|
610
|
+
sc: ::StringScanner,
|
611
|
+
stack: T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)]
|
612
|
+
).returns(T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)])
|
613
|
+
end
|
614
|
+
def parse_expr(sc, stack); end
|
615
|
+
end
|
616
|
+
|
617
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#42
|
618
|
+
CLI::UI::Formatter::BEGIN_EXPR = T.let(T.unsafe(nil), String)
|
619
|
+
|
620
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#57
|
621
|
+
CLI::UI::Formatter::DISCARD_BRACES = T.let(T.unsafe(nil), Range)
|
622
|
+
|
623
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#43
|
624
|
+
CLI::UI::Formatter::END_EXPR = T.let(T.unsafe(nil), String)
|
625
|
+
|
626
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#63
|
627
|
+
class CLI::UI::Formatter::FormatError < ::StandardError
|
628
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#73
|
629
|
+
sig { params(message: ::String, input: ::String, index: ::Integer).void }
|
630
|
+
def initialize(message, input, index); end
|
631
|
+
|
632
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#70
|
633
|
+
sig { returns(::Integer) }
|
634
|
+
def index; end
|
635
|
+
|
636
|
+
# @return [Integer]
|
637
|
+
#
|
638
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#70
|
639
|
+
def index=(_arg0); end
|
640
|
+
|
641
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#67
|
642
|
+
sig { returns(::String) }
|
643
|
+
def input; end
|
644
|
+
|
645
|
+
# @return [String]
|
646
|
+
#
|
647
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#67
|
648
|
+
def input=(_arg0); end
|
649
|
+
end
|
650
|
+
|
651
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#59
|
652
|
+
class CLI::UI::Formatter::LITERAL_BRACES; end
|
653
|
+
|
654
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#48
|
655
|
+
CLI::UI::Formatter::SCAN_BODY = T.let(T.unsafe(nil), Regexp)
|
656
|
+
|
657
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#46
|
658
|
+
CLI::UI::Formatter::SCAN_FUNCNAME = T.let(T.unsafe(nil), Regexp)
|
659
|
+
|
660
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#47
|
661
|
+
CLI::UI::Formatter::SCAN_GLYPH = T.let(T.unsafe(nil), Regexp)
|
662
|
+
|
663
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#45
|
664
|
+
CLI::UI::Formatter::SCAN_WIDGET = T.let(T.unsafe(nil), Regexp)
|
665
|
+
|
666
|
+
# Available mappings of formattings
|
667
|
+
# To use any of them, you can use {{<key>:<string>}}
|
668
|
+
# There are presentational (colours and formatters)
|
669
|
+
# and semantic (error, info, command) formatters available
|
670
|
+
#
|
671
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#17
|
672
|
+
CLI::UI::Formatter::SGR_MAP = T.let(T.unsafe(nil), Hash)
|
673
|
+
|
674
|
+
# source://cli-ui//lib/cli/ui/formatter.rb#61
|
675
|
+
CLI::UI::Formatter::Stack = T.type_alias { T::Array[T.any(::CLI::UI::Formatter::LITERAL_BRACES, ::String)] }
|
676
|
+
|
677
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#6
|
678
|
+
module CLI::UI::Frame
|
679
|
+
class << self
|
680
|
+
# Closes a frame
|
681
|
+
# Automatically called for a block-form +open+
|
682
|
+
#
|
683
|
+
# ==== Attributes
|
684
|
+
#
|
685
|
+
# * +text+ - (required) the text/title to output in the frame
|
686
|
+
#
|
687
|
+
# ==== Options
|
688
|
+
#
|
689
|
+
# * +:color+ - The color of the frame. Defaults to nil
|
690
|
+
# * +:elapsed+ - How long did the frame take? Defaults to nil
|
691
|
+
# * +frame_style+ - The frame style to use for this frame. Defaults to nil
|
692
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
693
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout.
|
694
|
+
#
|
695
|
+
# ==== Example
|
696
|
+
#
|
697
|
+
# CLI::UI::Frame.close('Close')
|
698
|
+
#
|
699
|
+
# Default Output:
|
700
|
+
# ┗━━ Close ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
701
|
+
#
|
702
|
+
# ==== Raises
|
703
|
+
#
|
704
|
+
# MUST be inside an open frame or it raises a +UnnestedFrameException+
|
705
|
+
#
|
706
|
+
# @raise [UnnestedFrameException]
|
707
|
+
#
|
708
|
+
# source://cli-ui//lib/cli/ui/frame.rb#230
|
709
|
+
sig do
|
710
|
+
params(
|
711
|
+
text: T.nilable(::String),
|
712
|
+
color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol)),
|
713
|
+
elapsed: T.nilable(::Numeric),
|
714
|
+
frame_style: T.nilable(T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)),
|
715
|
+
to: T.any(::IO, ::StringIO)
|
716
|
+
).void
|
717
|
+
end
|
718
|
+
def close(text, color: T.unsafe(nil), elapsed: T.unsafe(nil), frame_style: T.unsafe(nil), to: T.unsafe(nil)); end
|
719
|
+
|
720
|
+
# Adds a divider in a frame
|
721
|
+
# Used to separate information within a single frame
|
722
|
+
#
|
723
|
+
# ==== Attributes
|
724
|
+
#
|
725
|
+
# * +text+ - (required) the text/title to output in the frame
|
726
|
+
#
|
727
|
+
# ==== Options
|
728
|
+
#
|
729
|
+
# * +:color+ - The color of the frame. Defaults to +DEFAULT_FRAME_COLOR+
|
730
|
+
# * +frame_style+ - The frame style to use for this frame
|
731
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
732
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout.
|
733
|
+
#
|
734
|
+
# ==== Example
|
735
|
+
#
|
736
|
+
# CLI::UI::Frame.open('Open') { CLI::UI::Frame.divider('Divider') }
|
737
|
+
#
|
738
|
+
# Default Output:
|
739
|
+
# ┏━━ Open ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
740
|
+
# ┣━━ Divider ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
741
|
+
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
742
|
+
#
|
743
|
+
# ==== Raises
|
744
|
+
#
|
745
|
+
# MUST be inside an open frame or it raises a +UnnestedFrameException+
|
746
|
+
#
|
747
|
+
# @raise [UnnestedFrameException]
|
748
|
+
#
|
749
|
+
# source://cli-ui//lib/cli/ui/frame.rb#180
|
750
|
+
sig do
|
751
|
+
params(
|
752
|
+
text: T.nilable(::String),
|
753
|
+
color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol)),
|
754
|
+
frame_style: T.nilable(T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)),
|
755
|
+
to: T.any(::IO, ::StringIO)
|
756
|
+
).void
|
757
|
+
end
|
758
|
+
def divider(text, color: T.unsafe(nil), frame_style: T.unsafe(nil), to: T.unsafe(nil)); end
|
759
|
+
|
760
|
+
# source://cli-ui//lib/cli/ui/frame.rb#18
|
761
|
+
sig { returns(::CLI::UI::Frame::FrameStyle) }
|
762
|
+
def frame_style; end
|
763
|
+
|
764
|
+
# Set the default frame style.
|
765
|
+
#
|
766
|
+
# Raises ArgumentError if +frame_style+ is not valid
|
767
|
+
#
|
768
|
+
# ==== Attributes
|
769
|
+
#
|
770
|
+
# * +symbol+ or +FrameStyle+ - the default frame style to use for frames
|
771
|
+
#
|
772
|
+
# source://cli-ui//lib/cli/ui/frame.rb#31
|
773
|
+
sig { params(frame_style: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)).void }
|
774
|
+
def frame_style=(frame_style); end
|
775
|
+
|
776
|
+
# Opens a new frame. Can be nested
|
777
|
+
# Can be invoked in two ways: block and blockless
|
778
|
+
# * In block form, the frame is closed automatically when the block returns
|
779
|
+
# * In blockless form, caller MUST call +Frame.close+ when the frame is logically done
|
780
|
+
# * Blockless form is strongly discouraged in cases where block form can be made to work
|
781
|
+
#
|
782
|
+
# https://user-images.githubusercontent.com/3074765/33799861-cb5dcb5c-dd01-11e7-977e-6fad38cee08c.png
|
783
|
+
#
|
784
|
+
# The return value of the block determines if the block is a "success" or a "failure"
|
785
|
+
#
|
786
|
+
# ==== Attributes
|
787
|
+
#
|
788
|
+
# * +text+ - (required) the text/title to output in the frame
|
789
|
+
#
|
790
|
+
# ==== Options
|
791
|
+
#
|
792
|
+
# * +:color+ - The color of the frame. Defaults to +DEFAULT_FRAME_COLOR+
|
793
|
+
# * +:failure_text+ - If the block failed, what do we output? Defaults to nil
|
794
|
+
# * +:success_text+ - If the block succeeds, what do we output? Defaults to nil
|
795
|
+
# * +:timing+ - How long did the frame content take? Invalid for blockless. Defaults to true for the block form
|
796
|
+
# * +frame_style+ - The frame style to use for this frame
|
797
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
798
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout.
|
799
|
+
#
|
800
|
+
# ==== Example
|
801
|
+
#
|
802
|
+
# ===== Block Form (Assumes +CLI::UI::StdoutRouter.enable+ has been called)
|
803
|
+
#
|
804
|
+
# CLI::UI::Frame.open('Open') { puts 'hi' }
|
805
|
+
#
|
806
|
+
# Default Output:
|
807
|
+
# ┏━━ Open ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
808
|
+
# ┃ hi
|
809
|
+
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ (0.0s) ━━
|
810
|
+
#
|
811
|
+
# ===== Blockless Form
|
812
|
+
#
|
813
|
+
# CLI::UI::Frame.open('Open')
|
814
|
+
#
|
815
|
+
# Default Output:
|
816
|
+
# ┏━━ Open ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
817
|
+
#
|
818
|
+
# source://cli-ui//lib/cli/ui/frame.rb#90
|
819
|
+
sig do
|
820
|
+
type_parameters(:T)
|
821
|
+
.params(
|
822
|
+
text: ::String,
|
823
|
+
color: T.any(::CLI::UI::Color, ::String, ::Symbol),
|
824
|
+
failure_text: T.nilable(::String),
|
825
|
+
success_text: T.nilable(::String),
|
826
|
+
timing: T.any(::Numeric, T::Boolean),
|
827
|
+
frame_style: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol),
|
828
|
+
to: T.any(::IO, ::StringIO),
|
829
|
+
block: T.nilable(T.proc.returns(T.type_parameter(:T)))
|
830
|
+
).returns(T.nilable(T.type_parameter(:T)))
|
831
|
+
end
|
832
|
+
def open(text, color: T.unsafe(nil), failure_text: T.unsafe(nil), success_text: T.unsafe(nil), timing: T.unsafe(nil), frame_style: T.unsafe(nil), to: T.unsafe(nil), &block); end
|
833
|
+
|
834
|
+
# Determines the prefix of a frame entry taking multi-nested frames into account
|
835
|
+
#
|
836
|
+
# ==== Options
|
837
|
+
#
|
838
|
+
# * +:color+ - The color of the prefix. Defaults to +Thread.current[:cliui_frame_color_override]+
|
839
|
+
#
|
840
|
+
# source://cli-ui//lib/cli/ui/frame.rb#251
|
841
|
+
sig { params(color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol))).returns(::String) }
|
842
|
+
def prefix(color: T.unsafe(nil)); end
|
843
|
+
|
844
|
+
# The width of a prefix given the number of Frames in the stack
|
845
|
+
#
|
846
|
+
# source://cli-ui//lib/cli/ui/frame.rb#273
|
847
|
+
sig { returns(::Integer) }
|
848
|
+
def prefix_width; end
|
849
|
+
|
850
|
+
# Override a color for a given thread.
|
851
|
+
#
|
852
|
+
# ==== Attributes
|
853
|
+
#
|
854
|
+
# * +color+ - The color to override to
|
855
|
+
#
|
856
|
+
# source://cli-ui//lib/cli/ui/frame.rb#292
|
857
|
+
sig do
|
858
|
+
type_parameters(:T)
|
859
|
+
.params(
|
860
|
+
color: T.any(::CLI::UI::Color, ::String, ::Symbol),
|
861
|
+
block: T.proc.returns(T.type_parameter(:T))
|
862
|
+
).returns(T.type_parameter(:T))
|
863
|
+
end
|
864
|
+
def with_frame_color_override(color, &block); end
|
865
|
+
|
866
|
+
private
|
867
|
+
|
868
|
+
# If timing is:
|
869
|
+
# Numeric: return it
|
870
|
+
# false: return nil
|
871
|
+
# true: defaults to Time.new
|
872
|
+
#
|
873
|
+
# source://cli-ui//lib/cli/ui/frame.rb#307
|
874
|
+
sig { params(start: ::Time, timing: T.any(::Numeric, T::Boolean)).returns(T.nilable(::Numeric)) }
|
875
|
+
def elapsed(start, timing); end
|
876
|
+
end
|
877
|
+
end
|
878
|
+
|
879
|
+
# source://cli-ui//lib/cli/ui/frame.rb#12
|
880
|
+
CLI::UI::Frame::DEFAULT_FRAME_COLOR = T.let(T.unsafe(nil), CLI::UI::Color)
|
881
|
+
|
882
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#7
|
883
|
+
module CLI::UI::Frame::FrameStack
|
884
|
+
class << self
|
885
|
+
# Fetch all items off the frame stack
|
886
|
+
#
|
887
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#32
|
888
|
+
sig { returns(T::Array[::CLI::UI::Frame::FrameStack::StackItem]) }
|
889
|
+
def items; end
|
890
|
+
|
891
|
+
# Removes and returns the last stack item off the stack
|
892
|
+
#
|
893
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#72
|
894
|
+
sig { returns(T.nilable(::CLI::UI::Frame::FrameStack::StackItem)) }
|
895
|
+
def pop; end
|
896
|
+
|
897
|
+
# Push a new item onto the frame stack.
|
898
|
+
#
|
899
|
+
# Either an item or a :color/:style pair should be pushed onto the stack.
|
900
|
+
#
|
901
|
+
# ==== Attributes
|
902
|
+
#
|
903
|
+
# * +item+ a +StackItem+ to push onto the stack. Defaults to nil
|
904
|
+
#
|
905
|
+
# ==== Options
|
906
|
+
#
|
907
|
+
# * +:color+ the color of the new stack item. Defaults to nil
|
908
|
+
# * +:style+ the style of the new stack item. Defaults to nil
|
909
|
+
#
|
910
|
+
# ==== Raises
|
911
|
+
#
|
912
|
+
# If both an item and a color/style pair are given, raises an +ArgumentError+
|
913
|
+
# If the given item is not a +StackItem+, raises an +ArgumentError+
|
914
|
+
#
|
915
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#62
|
916
|
+
sig do
|
917
|
+
params(
|
918
|
+
item: T.nilable(::CLI::UI::Frame::FrameStack::StackItem),
|
919
|
+
color: T.nilable(::CLI::UI::Color),
|
920
|
+
style: T.nilable(::CLI::UI::Frame::FrameStyle)
|
921
|
+
).void
|
922
|
+
end
|
923
|
+
def push(item = T.unsafe(nil), color: T.unsafe(nil), style: T.unsafe(nil)); end
|
924
|
+
end
|
925
|
+
end
|
926
|
+
|
927
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#8
|
928
|
+
class CLI::UI::Frame::FrameStack::StackItem
|
929
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#21
|
930
|
+
sig do
|
931
|
+
params(
|
932
|
+
color_name: T.any(::CLI::UI::Color, ::String, ::Symbol),
|
933
|
+
style_name: T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol)
|
934
|
+
).void
|
935
|
+
end
|
936
|
+
def initialize(color_name, style_name); end
|
937
|
+
|
938
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#12
|
939
|
+
sig { returns(::CLI::UI::Color) }
|
940
|
+
def color; end
|
941
|
+
|
942
|
+
# source://cli-ui//lib/cli/ui/frame/frame_stack.rb#15
|
943
|
+
sig { returns(::CLI::UI::Frame::FrameStyle) }
|
944
|
+
def frame_style; end
|
945
|
+
end
|
946
|
+
|
947
|
+
# @abstract Subclasses must implement the `abstract` methods below.
|
948
|
+
#
|
949
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#9
|
950
|
+
module CLI::UI::Frame::FrameStyle
|
951
|
+
include ::Kernel
|
952
|
+
|
953
|
+
abstract!
|
954
|
+
|
955
|
+
# Draws the "Close" line for this frame style
|
956
|
+
#
|
957
|
+
# ==== Attributes
|
958
|
+
#
|
959
|
+
# * +text+ - (required) the text/title to output in the frame
|
960
|
+
#
|
961
|
+
# ==== Options
|
962
|
+
#
|
963
|
+
# * +:color+ - (required) The color of the frame.
|
964
|
+
# * +:right_text+ - Text to print at the right of the line. Defaults to nil
|
965
|
+
#
|
966
|
+
# @abstract
|
967
|
+
#
|
968
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#78
|
969
|
+
sig { abstract.params(text: ::String, color: ::CLI::UI::Color, right_text: T.nilable(::String)).returns(::String) }
|
970
|
+
def close(text, color:, right_text: T.unsafe(nil)); end
|
971
|
+
|
972
|
+
# Draws a "divider" line for the current frame style
|
973
|
+
#
|
974
|
+
# ==== Attributes
|
975
|
+
#
|
976
|
+
# * +text+ - (required) the text/title to output in the frame
|
977
|
+
#
|
978
|
+
# ==== Options
|
979
|
+
#
|
980
|
+
# * +:color+ - (required) The color of the frame.
|
981
|
+
#
|
982
|
+
# @abstract
|
983
|
+
#
|
984
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#91
|
985
|
+
sig { abstract.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
986
|
+
def divider(text, color:); end
|
987
|
+
|
988
|
+
# Returns the character(s) that should be printed at the beginning
|
989
|
+
# of lines inside this frame
|
990
|
+
#
|
991
|
+
# @abstract
|
992
|
+
#
|
993
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#45
|
994
|
+
sig { abstract.returns(::String) }
|
995
|
+
def prefix; end
|
996
|
+
|
997
|
+
# Returns the printing width of the prefix
|
998
|
+
#
|
999
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#49
|
1000
|
+
sig { returns(::Integer) }
|
1001
|
+
def prefix_width; end
|
1002
|
+
|
1003
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#94
|
1004
|
+
sig { params(x: ::Integer, str: ::String).returns(::String) }
|
1005
|
+
def print_at_x(x, str); end
|
1006
|
+
|
1007
|
+
# Draws the "Open" line for this frame style
|
1008
|
+
#
|
1009
|
+
# ==== Attributes
|
1010
|
+
#
|
1011
|
+
# * +text+ - (required) the text/title to output in the frame
|
1012
|
+
#
|
1013
|
+
# ==== Options
|
1014
|
+
#
|
1015
|
+
# * +:color+ - (required) The color of the frame.
|
1016
|
+
#
|
1017
|
+
# @abstract
|
1018
|
+
#
|
1019
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#64
|
1020
|
+
sig { abstract.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
1021
|
+
def start(text, color:); end
|
1022
|
+
|
1023
|
+
# @abstract
|
1024
|
+
#
|
1025
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#40
|
1026
|
+
sig { abstract.returns(::Symbol) }
|
1027
|
+
def style_name; end
|
1028
|
+
|
1029
|
+
class << self
|
1030
|
+
# Lookup a frame style via its name
|
1031
|
+
#
|
1032
|
+
# ==== Attributes
|
1033
|
+
#
|
1034
|
+
# * +symbol+ - frame style name to lookup
|
1035
|
+
#
|
1036
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#32
|
1037
|
+
sig { params(name: T.any(::String, ::Symbol)).returns(::CLI::UI::Frame::FrameStyle) }
|
1038
|
+
def lookup(name); end
|
1039
|
+
end
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#8
|
1043
|
+
module CLI::UI::Frame::FrameStyle::Box
|
1044
|
+
extend ::CLI::UI::Frame::FrameStyle
|
1045
|
+
|
1046
|
+
class << self
|
1047
|
+
# Draws the "Close" line for this frame style
|
1048
|
+
#
|
1049
|
+
# ==== Attributes
|
1050
|
+
#
|
1051
|
+
# * +text+ - (required) the text/title to output in the frame
|
1052
|
+
#
|
1053
|
+
# ==== Options
|
1054
|
+
#
|
1055
|
+
# * +:color+ - (required) The color of the frame.
|
1056
|
+
# * +:right_text+ - Text to print at the right of the line. Defaults to nil
|
1057
|
+
#
|
1058
|
+
# ==== Output:
|
1059
|
+
#
|
1060
|
+
# ┗━━ Close ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
1061
|
+
#
|
1062
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#84
|
1063
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color, right_text: T.nilable(::String)).returns(::String) }
|
1064
|
+
def close(text, color:, right_text: T.unsafe(nil)); end
|
1065
|
+
|
1066
|
+
# Draws a "divider" line for the current frame style
|
1067
|
+
#
|
1068
|
+
# ==== Attributes
|
1069
|
+
#
|
1070
|
+
# * +text+ - (required) the text/title to output in the frame
|
1071
|
+
#
|
1072
|
+
# ==== Options
|
1073
|
+
#
|
1074
|
+
# * +:color+ - (required) The color of the frame.
|
1075
|
+
#
|
1076
|
+
# ==== Output:
|
1077
|
+
#
|
1078
|
+
# ┣━━ Divider ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
1079
|
+
#
|
1080
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#64
|
1081
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
1082
|
+
def divider(text, color:); end
|
1083
|
+
|
1084
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#26
|
1085
|
+
sig { override.returns(::String) }
|
1086
|
+
def prefix; end
|
1087
|
+
|
1088
|
+
# Draws the "Open" line for this frame style
|
1089
|
+
#
|
1090
|
+
# ==== Attributes
|
1091
|
+
#
|
1092
|
+
# * +text+ - (required) the text/title to output in the frame
|
1093
|
+
#
|
1094
|
+
# ==== Options
|
1095
|
+
#
|
1096
|
+
# * +:color+ - (required) The color of the frame.
|
1097
|
+
#
|
1098
|
+
# ==== Output:
|
1099
|
+
#
|
1100
|
+
# ┏━━ Open ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
1101
|
+
#
|
1102
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#45
|
1103
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
1104
|
+
def start(text, color:); end
|
1105
|
+
|
1106
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#21
|
1107
|
+
sig { override.returns(::Symbol) }
|
1108
|
+
def style_name; end
|
1109
|
+
|
1110
|
+
private
|
1111
|
+
|
1112
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#93
|
1113
|
+
sig do
|
1114
|
+
params(
|
1115
|
+
text: ::String,
|
1116
|
+
color: ::CLI::UI::Color,
|
1117
|
+
first: ::String,
|
1118
|
+
right_text: T.nilable(::String)
|
1119
|
+
).returns(::String)
|
1120
|
+
end
|
1121
|
+
def edge(text, color:, first:, right_text: T.unsafe(nil)); end
|
1122
|
+
end
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#15
|
1126
|
+
CLI::UI::Frame::FrameStyle::Box::BOTTOM_LEFT = T.let(T.unsafe(nil), String)
|
1127
|
+
|
1128
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#13
|
1129
|
+
CLI::UI::Frame::FrameStyle::Box::DIVIDER = T.let(T.unsafe(nil), String)
|
1130
|
+
|
1131
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#12
|
1132
|
+
CLI::UI::Frame::FrameStyle::Box::HORIZONTAL = T.let(T.unsafe(nil), String)
|
1133
|
+
|
1134
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#14
|
1135
|
+
CLI::UI::Frame::FrameStyle::Box::TOP_LEFT = T.let(T.unsafe(nil), String)
|
1136
|
+
|
1137
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/box.rb#11
|
1138
|
+
CLI::UI::Frame::FrameStyle::Box::VERTICAL = T.let(T.unsafe(nil), String)
|
1139
|
+
|
1140
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#8
|
1141
|
+
module CLI::UI::Frame::FrameStyle::Bracket
|
1142
|
+
extend ::CLI::UI::Frame::FrameStyle
|
1143
|
+
|
1144
|
+
class << self
|
1145
|
+
# Draws the "Close" line for this frame style
|
1146
|
+
#
|
1147
|
+
# ==== Attributes
|
1148
|
+
#
|
1149
|
+
# * +text+ - (required) the text/title to output in the frame
|
1150
|
+
#
|
1151
|
+
# ==== Options
|
1152
|
+
#
|
1153
|
+
# * +:color+ - (required) The color of the frame.
|
1154
|
+
# * +:right_text+ - Text to print at the right of the line. Defaults to nil
|
1155
|
+
#
|
1156
|
+
# ==== Output:
|
1157
|
+
#
|
1158
|
+
# ┗━━ Close
|
1159
|
+
#
|
1160
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#84
|
1161
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color, right_text: T.nilable(::String)).returns(::String) }
|
1162
|
+
def close(text, color:, right_text: T.unsafe(nil)); end
|
1163
|
+
|
1164
|
+
# Draws a "divider" line for the current frame style
|
1165
|
+
#
|
1166
|
+
# ==== Attributes
|
1167
|
+
#
|
1168
|
+
# * +text+ - (required) the text/title to output in the frame
|
1169
|
+
#
|
1170
|
+
# ==== Options
|
1171
|
+
#
|
1172
|
+
# * +:color+ - (required) The color of the frame.
|
1173
|
+
#
|
1174
|
+
# ==== Output:
|
1175
|
+
#
|
1176
|
+
# ┣━━ Divider
|
1177
|
+
#
|
1178
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#64
|
1179
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
1180
|
+
def divider(text, color:); end
|
1181
|
+
|
1182
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#26
|
1183
|
+
sig { override.returns(::String) }
|
1184
|
+
def prefix; end
|
1185
|
+
|
1186
|
+
# Draws the "Open" line for this frame style
|
1187
|
+
#
|
1188
|
+
# ==== Attributes
|
1189
|
+
#
|
1190
|
+
# * +text+ - (required) the text/title to output in the frame
|
1191
|
+
#
|
1192
|
+
# ==== Options
|
1193
|
+
#
|
1194
|
+
# * +:color+ - (required) The color of the frame.
|
1195
|
+
#
|
1196
|
+
# ==== Output
|
1197
|
+
#
|
1198
|
+
# ┏━━ Open
|
1199
|
+
#
|
1200
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#45
|
1201
|
+
sig { override.params(text: ::String, color: ::CLI::UI::Color).returns(::String) }
|
1202
|
+
def start(text, color:); end
|
1203
|
+
|
1204
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#21
|
1205
|
+
sig { override.returns(::Symbol) }
|
1206
|
+
def style_name; end
|
1207
|
+
|
1208
|
+
private
|
1209
|
+
|
1210
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#93
|
1211
|
+
sig do
|
1212
|
+
params(
|
1213
|
+
text: ::String,
|
1214
|
+
color: ::CLI::UI::Color,
|
1215
|
+
first: ::String,
|
1216
|
+
right_text: T.nilable(::String)
|
1217
|
+
).returns(::String)
|
1218
|
+
end
|
1219
|
+
def edge(text, color:, first:, right_text: T.unsafe(nil)); end
|
1220
|
+
end
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#15
|
1224
|
+
CLI::UI::Frame::FrameStyle::Bracket::BOTTOM_LEFT = T.let(T.unsafe(nil), String)
|
1225
|
+
|
1226
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#13
|
1227
|
+
CLI::UI::Frame::FrameStyle::Bracket::DIVIDER = T.let(T.unsafe(nil), String)
|
1228
|
+
|
1229
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#12
|
1230
|
+
CLI::UI::Frame::FrameStyle::Bracket::HORIZONTAL = T.let(T.unsafe(nil), String)
|
1231
|
+
|
1232
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#14
|
1233
|
+
CLI::UI::Frame::FrameStyle::Bracket::TOP_LEFT = T.let(T.unsafe(nil), String)
|
1234
|
+
|
1235
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style/bracket.rb#11
|
1236
|
+
CLI::UI::Frame::FrameStyle::Bracket::VERTICAL = T.let(T.unsafe(nil), String)
|
1237
|
+
|
1238
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#98
|
1239
|
+
class CLI::UI::Frame::FrameStyle::InvalidFrameStyleName < ::ArgumentError
|
1240
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#102
|
1241
|
+
sig { params(name: T.any(::String, ::Symbol)).void }
|
1242
|
+
def initialize(name); end
|
1243
|
+
|
1244
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#108
|
1245
|
+
sig { returns(::String) }
|
1246
|
+
def message; end
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
# source://cli-ui//lib/cli/ui/frame/frame_style.rb#18
|
1250
|
+
CLI::UI::Frame::FrameStyle::MAP = T.let(T.unsafe(nil), Hash)
|
1251
|
+
|
1252
|
+
# source://cli-ui//lib/cli/ui/frame.rb#11
|
1253
|
+
class CLI::UI::Frame::UnnestedFrameException < ::StandardError; end
|
1254
|
+
|
1255
|
+
# source://cli-ui//lib/cli/ui.rb#32
|
1256
|
+
CLI::UI::FrameStylable = T.type_alias { T.any(::CLI::UI::Frame::FrameStyle, ::String, ::Symbol) }
|
1257
|
+
|
1258
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#8
|
1259
|
+
class CLI::UI::Glyph
|
1260
|
+
# Creates a new glyph
|
1261
|
+
#
|
1262
|
+
# ==== Attributes
|
1263
|
+
#
|
1264
|
+
# * +handle+ - The handle in the +MAP+ constant
|
1265
|
+
# * +codepoint+ - The codepoint used to create the glyph (e.g. +0x2717+ for a ballot X)
|
1266
|
+
# * +plain+ - A fallback plain string to be used in case glyphs are disabled
|
1267
|
+
# * +color+ - What color to output the glyph. Check +CLI::UI::Color+ for options.
|
1268
|
+
#
|
1269
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#47
|
1270
|
+
sig do
|
1271
|
+
params(
|
1272
|
+
handle: ::String,
|
1273
|
+
codepoint: T.any(::Integer, T::Array[::Integer]),
|
1274
|
+
plain: ::String,
|
1275
|
+
color: ::CLI::UI::Color
|
1276
|
+
).void
|
1277
|
+
end
|
1278
|
+
def initialize(handle, codepoint, plain, color); end
|
1279
|
+
|
1280
|
+
# @return [String]
|
1281
|
+
#
|
1282
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#29
|
1283
|
+
def char; end
|
1284
|
+
|
1285
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#32
|
1286
|
+
sig { returns(T.any(::Integer, T::Array[::Integer])) }
|
1287
|
+
def codepoint; end
|
1288
|
+
|
1289
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#35
|
1290
|
+
sig { returns(::CLI::UI::Color) }
|
1291
|
+
def color; end
|
1292
|
+
|
1293
|
+
# @return [String]
|
1294
|
+
#
|
1295
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#29
|
1296
|
+
def fmt; end
|
1297
|
+
|
1298
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#29
|
1299
|
+
sig { returns(::String) }
|
1300
|
+
def handle; end
|
1301
|
+
|
1302
|
+
# @return [String]
|
1303
|
+
#
|
1304
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#29
|
1305
|
+
def to_s; end
|
1306
|
+
|
1307
|
+
class << self
|
1308
|
+
# All available glyphs by name
|
1309
|
+
#
|
1310
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#92
|
1311
|
+
sig { returns(T::Array[::String]) }
|
1312
|
+
def available; end
|
1313
|
+
|
1314
|
+
# Looks up a glyph by name
|
1315
|
+
#
|
1316
|
+
# ==== Raises
|
1317
|
+
# Raises a InvalidGlyphHandle if the glyph is not available
|
1318
|
+
# You likely need to create it with +.new+ or you made a typo
|
1319
|
+
#
|
1320
|
+
# ==== Returns
|
1321
|
+
# Returns a terminal output-capable string
|
1322
|
+
#
|
1323
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#83
|
1324
|
+
sig { params(name: ::String).returns(::CLI::UI::Glyph) }
|
1325
|
+
def lookup(name); end
|
1326
|
+
end
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
# Bug emoji (🐛)
|
1330
|
+
#
|
1331
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#65
|
1332
|
+
CLI::UI::Glyph::BUG = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1333
|
+
|
1334
|
+
# GREEN CHECK MARK (✓)
|
1335
|
+
#
|
1336
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#63
|
1337
|
+
CLI::UI::Glyph::CHECK = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1338
|
+
|
1339
|
+
# RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (»)
|
1340
|
+
#
|
1341
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#66
|
1342
|
+
CLI::UI::Glyph::CHEVRON = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1343
|
+
|
1344
|
+
# HOURGLASS (⧖)
|
1345
|
+
#
|
1346
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#67
|
1347
|
+
CLI::UI::Glyph::HOURGLASS = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1348
|
+
|
1349
|
+
# BLUE MATHEMATICAL SCRIPT SMALL i (𝒾)
|
1350
|
+
#
|
1351
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#61
|
1352
|
+
CLI::UI::Glyph::INFO = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1353
|
+
|
1354
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#11
|
1355
|
+
class CLI::UI::Glyph::InvalidGlyphHandle < ::ArgumentError
|
1356
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#15
|
1357
|
+
sig { params(handle: ::String).void }
|
1358
|
+
def initialize(handle); end
|
1359
|
+
|
1360
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#21
|
1361
|
+
sig { returns(::String) }
|
1362
|
+
def message; end
|
1363
|
+
end
|
1364
|
+
|
1365
|
+
# Mapping of glyphs to terminal output
|
1366
|
+
#
|
1367
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#59
|
1368
|
+
CLI::UI::Glyph::MAP = T.let(T.unsafe(nil), Hash)
|
1369
|
+
|
1370
|
+
# BLUE QUESTION MARK (?)
|
1371
|
+
#
|
1372
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#62
|
1373
|
+
CLI::UI::Glyph::QUESTION = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1374
|
+
|
1375
|
+
# YELLOW SMALL STAR (⭑)
|
1376
|
+
#
|
1377
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#60
|
1378
|
+
CLI::UI::Glyph::STAR = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1379
|
+
|
1380
|
+
# WARNING SIGN + VARIATION SELECTOR 16 (⚠️ )
|
1381
|
+
#
|
1382
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#68
|
1383
|
+
CLI::UI::Glyph::WARNING = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1384
|
+
|
1385
|
+
# RED BALLOT X (✗)
|
1386
|
+
#
|
1387
|
+
# source://cli-ui//lib/cli/ui/glyph.rb#64
|
1388
|
+
CLI::UI::Glyph::X = T.let(T.unsafe(nil), CLI::UI::Glyph)
|
1389
|
+
|
1390
|
+
# source://cli-ui//lib/cli/ui.rb#33
|
1391
|
+
CLI::UI::IOLike = T.type_alias { T.any(::IO, ::StringIO) }
|
1392
|
+
|
1393
|
+
# source://cli-ui//lib/cli/ui/os.rb#8
|
1394
|
+
class CLI::UI::OS
|
1395
|
+
# source://cli-ui//lib/cli/ui/os.rb#12
|
1396
|
+
sig { params(emoji: T::Boolean, color_prompt: T::Boolean, arrow_keys: T::Boolean, shift_cursor: T::Boolean).void }
|
1397
|
+
def initialize(emoji: T.unsafe(nil), color_prompt: T.unsafe(nil), arrow_keys: T.unsafe(nil), shift_cursor: T.unsafe(nil)); end
|
1398
|
+
|
1399
|
+
# source://cli-ui//lib/cli/ui/os.rb#35
|
1400
|
+
sig { returns(T::Boolean) }
|
1401
|
+
def shift_cursor_back_on_horizontal_absolute?; end
|
1402
|
+
|
1403
|
+
# source://cli-ui//lib/cli/ui/os.rb#30
|
1404
|
+
sig { returns(T::Boolean) }
|
1405
|
+
def suggest_arrow_keys?; end
|
1406
|
+
|
1407
|
+
# source://cli-ui//lib/cli/ui/os.rb#25
|
1408
|
+
sig { returns(T::Boolean) }
|
1409
|
+
def use_color_prompt?; end
|
1410
|
+
|
1411
|
+
# source://cli-ui//lib/cli/ui/os.rb#20
|
1412
|
+
sig { returns(T::Boolean) }
|
1413
|
+
def use_emoji?; end
|
1414
|
+
|
1415
|
+
class << self
|
1416
|
+
# source://cli-ui//lib/cli/ui/os.rb#43
|
1417
|
+
sig { returns(::CLI::UI::OS) }
|
1418
|
+
def current; end
|
1419
|
+
end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
# source://cli-ui//lib/cli/ui/os.rb#60
|
1423
|
+
CLI::UI::OS::LINUX = T.let(T.unsafe(nil), CLI::UI::OS)
|
1424
|
+
|
1425
|
+
# source://cli-ui//lib/cli/ui/os.rb#59
|
1426
|
+
CLI::UI::OS::MAC = T.let(T.unsafe(nil), CLI::UI::OS)
|
1427
|
+
|
1428
|
+
# source://cli-ui//lib/cli/ui/os.rb#61
|
1429
|
+
CLI::UI::OS::WINDOWS = T.let(T.unsafe(nil), CLI::UI::OS)
|
1430
|
+
|
1431
|
+
# source://cli-ui//lib/cli/ui/printer.rb#8
|
1432
|
+
class CLI::UI::Printer
|
1433
|
+
class << self
|
1434
|
+
# Print a message to a stream with common utilities.
|
1435
|
+
# Allows overriding the color, encoding, and target stream.
|
1436
|
+
# By default, it formats the string using CLI:UI and rescues common stream errors.
|
1437
|
+
#
|
1438
|
+
# ==== Attributes
|
1439
|
+
#
|
1440
|
+
# * +msg+ - (required) the string to output. Can be frozen.
|
1441
|
+
#
|
1442
|
+
# ==== Options
|
1443
|
+
#
|
1444
|
+
# * +:frame_color+ - Override the frame color. Defaults to nil.
|
1445
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with a puts method. Defaults to $stdout.
|
1446
|
+
# * +:encoding+ - Force the output to be in a certain encoding. Defaults to UTF-8.
|
1447
|
+
# * +:format+ - Whether to format the string using CLI::UI.fmt. Defaults to true.
|
1448
|
+
# * +:graceful+ - Whether to gracefully ignore common I/O errors. Defaults to true.
|
1449
|
+
# * +:wrap+ - Whether to wrap text at word boundaries to terminal width. Defaults to true.
|
1450
|
+
#
|
1451
|
+
# ==== Returns
|
1452
|
+
# Returns whether the message was successfully printed,
|
1453
|
+
# which can be useful if +:graceful+ is set to true.
|
1454
|
+
#
|
1455
|
+
# ==== Example
|
1456
|
+
#
|
1457
|
+
# CLI::UI::Printer.puts('{{x}} Ouch', to: $stderr)
|
1458
|
+
#
|
1459
|
+
# source://cli-ui//lib/cli/ui/printer.rb#50
|
1460
|
+
sig do
|
1461
|
+
params(
|
1462
|
+
msg: ::String,
|
1463
|
+
frame_color: T.nilable(T.any(::CLI::UI::Color, ::String, ::Symbol)),
|
1464
|
+
to: T.any(::IO, ::StringIO),
|
1465
|
+
encoding: T.nilable(::Encoding),
|
1466
|
+
format: T::Boolean,
|
1467
|
+
graceful: T::Boolean,
|
1468
|
+
wrap: T::Boolean
|
1469
|
+
).returns(T::Boolean)
|
1470
|
+
end
|
1471
|
+
def puts(msg, frame_color: T.unsafe(nil), to: T.unsafe(nil), encoding: T.unsafe(nil), format: T.unsafe(nil), graceful: T.unsafe(nil), wrap: T.unsafe(nil)); end
|
1472
|
+
end
|
1473
|
+
end
|
1474
|
+
|
1475
|
+
# source://cli-ui//lib/cli/ui/progress.rb#8
|
1476
|
+
class CLI::UI::Progress
|
1477
|
+
# Initialize a progress bar. Typically used in a +Progress.progress+ block
|
1478
|
+
#
|
1479
|
+
# ==== Options
|
1480
|
+
#
|
1481
|
+
# * +:title+ - The title of the progress bar
|
1482
|
+
# * +:width+ - The width of the terminal
|
1483
|
+
#
|
1484
|
+
# source://cli-ui//lib/cli/ui/progress.rb#74
|
1485
|
+
sig { params(title: T.nilable(::String), width: ::Integer).void }
|
1486
|
+
def initialize(title = T.unsafe(nil), width: T.unsafe(nil)); end
|
1487
|
+
|
1488
|
+
# Set the progress of the bar. Typically used in a +Progress.progress+ block
|
1489
|
+
#
|
1490
|
+
# ==== Options
|
1491
|
+
# One of the follow can be used, but not both together
|
1492
|
+
#
|
1493
|
+
# * +:percent+ - Increment progress by a specific percent amount
|
1494
|
+
# * +:set_percent+ - Set progress to a specific percent
|
1495
|
+
#
|
1496
|
+
# *Note:* The +:percent+ and +:set_percent must be between 0.00 and 1.0
|
1497
|
+
#
|
1498
|
+
# @raise [ArgumentError]
|
1499
|
+
#
|
1500
|
+
# source://cli-ui//lib/cli/ui/progress.rb#91
|
1501
|
+
sig { params(percent: T.nilable(::Numeric), set_percent: T.nilable(::Numeric)).void }
|
1502
|
+
def tick(percent: T.unsafe(nil), set_percent: T.unsafe(nil)); end
|
1503
|
+
|
1504
|
+
# Format the progress bar to be printed to terminal
|
1505
|
+
#
|
1506
|
+
# source://cli-ui//lib/cli/ui/progress.rb#118
|
1507
|
+
sig { returns(::String) }
|
1508
|
+
def to_s; end
|
1509
|
+
|
1510
|
+
# Update the progress bar title
|
1511
|
+
#
|
1512
|
+
# ==== Attributes
|
1513
|
+
#
|
1514
|
+
# * +new_title+ - title to change the progress bar to
|
1515
|
+
#
|
1516
|
+
# source://cli-ui//lib/cli/ui/progress.rb#111
|
1517
|
+
sig { params(new_title: ::String).void }
|
1518
|
+
def update_title(new_title); end
|
1519
|
+
|
1520
|
+
class << self
|
1521
|
+
# Add a progress bar to the terminal output
|
1522
|
+
#
|
1523
|
+
# https://user-images.githubusercontent.com/3074765/33799794-cc4c940e-dd00-11e7-9bdc-90f77ec9167c.gif
|
1524
|
+
#
|
1525
|
+
# ==== Example Usage:
|
1526
|
+
#
|
1527
|
+
# Set the percent to X
|
1528
|
+
# CLI::UI::Progress.progress do |bar|
|
1529
|
+
# bar.tick(set_percent: percent)
|
1530
|
+
# end
|
1531
|
+
#
|
1532
|
+
# Increase the percent by 1 percent
|
1533
|
+
# CLI::UI::Progress.progress do |bar|
|
1534
|
+
# bar.tick
|
1535
|
+
# end
|
1536
|
+
#
|
1537
|
+
# Increase the percent by X
|
1538
|
+
# CLI::UI::Progress.progress do |bar|
|
1539
|
+
# bar.tick(percent: 0.05)
|
1540
|
+
# end
|
1541
|
+
#
|
1542
|
+
# Update the title
|
1543
|
+
# CLI::UI::Progress.progress('Title') do |bar|
|
1544
|
+
# bar.tick(percent: 0.05)
|
1545
|
+
# bar.update_title('New title')
|
1546
|
+
# end
|
1547
|
+
#
|
1548
|
+
# source://cli-ui//lib/cli/ui/progress.rb#54
|
1549
|
+
sig do
|
1550
|
+
type_parameters(:T)
|
1551
|
+
.params(
|
1552
|
+
title: T.nilable(::String),
|
1553
|
+
width: ::Integer,
|
1554
|
+
block: T.proc.params(bar: ::CLI::UI::Progress).returns(T.type_parameter(:T))
|
1555
|
+
).returns(T.type_parameter(:T))
|
1556
|
+
end
|
1557
|
+
def progress(title = T.unsafe(nil), width: T.unsafe(nil), &block); end
|
1558
|
+
end
|
1559
|
+
end
|
1560
|
+
|
1561
|
+
# A Cyan filled block
|
1562
|
+
#
|
1563
|
+
# source://cli-ui//lib/cli/ui/progress.rb#12
|
1564
|
+
CLI::UI::Progress::FILLED_BAR = T.let(T.unsafe(nil), String)
|
1565
|
+
|
1566
|
+
# A bright white block
|
1567
|
+
#
|
1568
|
+
# source://cli-ui//lib/cli/ui/progress.rb#14
|
1569
|
+
CLI::UI::Progress::UNFILLED_BAR = T.let(T.unsafe(nil), String)
|
1570
|
+
|
1571
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#15
|
1572
|
+
module CLI::UI::Prompt
|
1573
|
+
class << self
|
1574
|
+
# Present the user with a message and wait for any key to be pressed, returning the pressed key.
|
1575
|
+
#
|
1576
|
+
# ==== Example Usage:
|
1577
|
+
#
|
1578
|
+
# CLI::UI::Prompt.any_key # Press any key to continue...
|
1579
|
+
#
|
1580
|
+
# CLI::UI::Prompt.any_key('Press RETURN to continue...') # Then check if that's what they pressed
|
1581
|
+
#
|
1582
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#212
|
1583
|
+
sig { params(prompt: ::String).returns(T.nilable(::String)) }
|
1584
|
+
def any_key(prompt = T.unsafe(nil)); end
|
1585
|
+
|
1586
|
+
# Ask a user a question with either free form answer or a set of answers (multiple choice)
|
1587
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control multiple choice selection
|
1588
|
+
# Do not use this method for yes/no questions. Use +confirm+
|
1589
|
+
#
|
1590
|
+
# * Handles free form answers (options are nil)
|
1591
|
+
# * Handles default answers for free form text
|
1592
|
+
# * Handles file auto completion for file input
|
1593
|
+
# * Handles interactively choosing answers using +InteractiveOptions+
|
1594
|
+
#
|
1595
|
+
# https://user-images.githubusercontent.com/3074765/33799822-47f23302-dd01-11e7-82f3-9072a5a5f611.png
|
1596
|
+
#
|
1597
|
+
# ==== Attributes
|
1598
|
+
#
|
1599
|
+
# * +question+ - (required) The question to ask the user
|
1600
|
+
#
|
1601
|
+
# ==== Options
|
1602
|
+
#
|
1603
|
+
# * +:options+ - Options that the user may select from. Will use +InteractiveOptions+ to do so.
|
1604
|
+
# * +:default+ - The default answer to the question (e.g. they just press enter and don't input anything)
|
1605
|
+
# * +:is_file+ - Tells the input to use file auto-completion (tab completion)
|
1606
|
+
# * +:allow_empty+ - Allows the answer to be empty
|
1607
|
+
# * +:multiple+ - Allow multiple options to be selected
|
1608
|
+
# * +:filter_ui+ - Enable option filtering (default: true)
|
1609
|
+
# * +:select_ui+ - Enable long-form option selection (default: true)
|
1610
|
+
#
|
1611
|
+
# Note:
|
1612
|
+
# * +:options+ or providing a +Block+ conflicts with +:default+ and +:is_file+,
|
1613
|
+
# you cannot set options with either of these keywords
|
1614
|
+
# * +:default+ conflicts with +:allow_empty:, you cannot set these together
|
1615
|
+
# * +:options+ conflicts with providing a +Block+ , you may only set one
|
1616
|
+
# * +:multiple+ can only be used with +:options+ or a +Block+; it is ignored, otherwise.
|
1617
|
+
#
|
1618
|
+
# ==== Block (optional)
|
1619
|
+
#
|
1620
|
+
# * A Proc that provides a +OptionsHandler+ and uses the public +:option+ method to add options and their
|
1621
|
+
# respective handlers
|
1622
|
+
#
|
1623
|
+
# ==== Return Value
|
1624
|
+
#
|
1625
|
+
# * If a +Block+ was not provided, the selected option or response to the free form question will be returned
|
1626
|
+
# * If a +Block+ was provided, the evaluated value of the +Block+ will be returned
|
1627
|
+
#
|
1628
|
+
# ==== Example Usage:
|
1629
|
+
#
|
1630
|
+
# Free form question
|
1631
|
+
# CLI::UI::Prompt.ask('What color is the sky?')
|
1632
|
+
#
|
1633
|
+
# Free form question with a file answer
|
1634
|
+
# CLI::UI::Prompt.ask('Where is your Gemfile located?', is_file: true)
|
1635
|
+
#
|
1636
|
+
# Free form question with a default answer
|
1637
|
+
# CLI::UI::Prompt.ask('What color is the sky?', default: 'blue')
|
1638
|
+
#
|
1639
|
+
# Free form question when the answer can be empty
|
1640
|
+
# CLI::UI::Prompt.ask('What is your opinion on this question?', allow_empty: true)
|
1641
|
+
#
|
1642
|
+
# Interactive (multiple choice) question
|
1643
|
+
# CLI::UI::Prompt.ask('What kind of project is this?', options: %w(rails go ruby python))
|
1644
|
+
#
|
1645
|
+
# Interactive (multiple choice) question with defined handlers
|
1646
|
+
# CLI::UI::Prompt.ask('What kind of project is this?') do |handler|
|
1647
|
+
# handler.option('rails') { |selection| selection }
|
1648
|
+
# handler.option('go') { |selection| selection }
|
1649
|
+
# handler.option('ruby') { |selection| selection }
|
1650
|
+
# handler.option('python') { |selection| selection }
|
1651
|
+
# end
|
1652
|
+
#
|
1653
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#118
|
1654
|
+
sig do
|
1655
|
+
params(
|
1656
|
+
question: ::String,
|
1657
|
+
options: T.nilable(T::Array[::String]),
|
1658
|
+
default: T.nilable(T.any(::String, T::Array[::String])),
|
1659
|
+
is_file: T::Boolean,
|
1660
|
+
allow_empty: T::Boolean,
|
1661
|
+
multiple: T::Boolean,
|
1662
|
+
filter_ui: T::Boolean,
|
1663
|
+
select_ui: T::Boolean,
|
1664
|
+
options_proc: T.nilable(T.proc.params(handler: ::CLI::UI::Prompt::OptionsHandler).void)
|
1665
|
+
).returns(T.any(::String, T::Array[::String]))
|
1666
|
+
end
|
1667
|
+
def ask(question, options: T.unsafe(nil), default: T.unsafe(nil), is_file: T.unsafe(nil), allow_empty: T.unsafe(nil), multiple: T.unsafe(nil), filter_ui: T.unsafe(nil), select_ui: T.unsafe(nil), &options_proc); end
|
1668
|
+
|
1669
|
+
# Asks the user for a single-line answer, without displaying the characters while typing.
|
1670
|
+
# Typically used for password prompts
|
1671
|
+
#
|
1672
|
+
# ==== Return Value
|
1673
|
+
#
|
1674
|
+
# The password, without a trailing newline.
|
1675
|
+
# If the user simply presses "Enter" without typing any password, this will return an empty string.
|
1676
|
+
#
|
1677
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#169
|
1678
|
+
sig { params(question: ::String).returns(::String) }
|
1679
|
+
def ask_password(question); end
|
1680
|
+
|
1681
|
+
# Asks the user a yes/no question.
|
1682
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
1683
|
+
#
|
1684
|
+
# ==== Example Usage:
|
1685
|
+
#
|
1686
|
+
# Confirmation question
|
1687
|
+
# CLI::UI::Prompt.confirm('Is the sky blue?')
|
1688
|
+
#
|
1689
|
+
# CLI::UI::Prompt.confirm('Do a dangerous thing?', default: false)
|
1690
|
+
#
|
1691
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#200
|
1692
|
+
sig { params(question: ::String, default: T::Boolean).returns(T::Boolean) }
|
1693
|
+
def confirm(question, default: T.unsafe(nil)); end
|
1694
|
+
|
1695
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#23
|
1696
|
+
sig { returns(::CLI::UI::Color) }
|
1697
|
+
def instructions_color; end
|
1698
|
+
|
1699
|
+
# Set the instructions color.
|
1700
|
+
#
|
1701
|
+
# ==== Attributes
|
1702
|
+
#
|
1703
|
+
# * +color+ - the color to use for prompt instructions
|
1704
|
+
#
|
1705
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#34
|
1706
|
+
sig { params(color: T.any(::CLI::UI::Color, ::String, ::Symbol)).void }
|
1707
|
+
def instructions_color=(color); end
|
1708
|
+
|
1709
|
+
# Wait for any key to be pressed, returning the pressed key.
|
1710
|
+
#
|
1711
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#221
|
1712
|
+
sig { returns(T.nilable(::String)) }
|
1713
|
+
def read_char; end
|
1714
|
+
|
1715
|
+
private
|
1716
|
+
|
1717
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#240
|
1718
|
+
sig do
|
1719
|
+
params(
|
1720
|
+
question: ::String,
|
1721
|
+
default: T.nilable(::String),
|
1722
|
+
is_file: T::Boolean,
|
1723
|
+
allow_empty: T::Boolean
|
1724
|
+
).returns(::String)
|
1725
|
+
end
|
1726
|
+
def ask_free_form(question, default, is_file, allow_empty); end
|
1727
|
+
|
1728
|
+
# @raise [ArgumentError]
|
1729
|
+
#
|
1730
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#278
|
1731
|
+
sig do
|
1732
|
+
params(
|
1733
|
+
question: ::String,
|
1734
|
+
options: T.nilable(T::Array[::String]),
|
1735
|
+
multiple: T::Boolean,
|
1736
|
+
default: T.nilable(T.any(::String, T::Array[::String])),
|
1737
|
+
filter_ui: T::Boolean,
|
1738
|
+
select_ui: T::Boolean
|
1739
|
+
).returns(T.any(::String, T::Array[::String]))
|
1740
|
+
end
|
1741
|
+
def ask_interactive(question, options = T.unsafe(nil), multiple: T.unsafe(nil), default: T.unsafe(nil), filter_ui: T.unsafe(nil), select_ui: T.unsafe(nil)); end
|
1742
|
+
|
1743
|
+
# Useful for stubbing in tests
|
1744
|
+
#
|
1745
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#339
|
1746
|
+
sig do
|
1747
|
+
params(
|
1748
|
+
options: T::Array[::String],
|
1749
|
+
multiple: T::Boolean,
|
1750
|
+
default: T.nilable(T.any(::String, T::Array[::String]))
|
1751
|
+
).returns(T.any(::String, T::Array[::String]))
|
1752
|
+
end
|
1753
|
+
def interactive_prompt(options, multiple: T.unsafe(nil), default: T.unsafe(nil)); end
|
1754
|
+
|
1755
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#359
|
1756
|
+
sig { params(str: ::String).void }
|
1757
|
+
def puts_question(str); end
|
1758
|
+
|
1759
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#364
|
1760
|
+
sig { params(is_file: T::Boolean).returns(::String) }
|
1761
|
+
def readline(is_file: T.unsafe(nil)); end
|
1762
|
+
|
1763
|
+
# source://cli-ui//lib/cli/ui/prompt.rb#346
|
1764
|
+
sig { params(default: ::String).void }
|
1765
|
+
def write_default_over_empty_input(default); end
|
1766
|
+
end
|
1767
|
+
end
|
1768
|
+
|
1769
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#10
|
1770
|
+
class CLI::UI::Prompt::InteractiveOptions
|
1771
|
+
# Initializes a new +InteractiveOptions+
|
1772
|
+
# Usually called from +self.call+
|
1773
|
+
#
|
1774
|
+
# ==== Example Usage:
|
1775
|
+
#
|
1776
|
+
# CLI::UI::Prompt::InteractiveOptions.new(%w(rails go python))
|
1777
|
+
#
|
1778
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#60
|
1779
|
+
sig do
|
1780
|
+
params(
|
1781
|
+
options: T::Array[::String],
|
1782
|
+
multiple: T::Boolean,
|
1783
|
+
default: T.nilable(T.any(::String, T::Array[::String]))
|
1784
|
+
).void
|
1785
|
+
end
|
1786
|
+
def initialize(options, multiple: T.unsafe(nil), default: T.unsafe(nil)); end
|
1787
|
+
|
1788
|
+
# Calls the +InteractiveOptions+ and asks the question
|
1789
|
+
# Usually used from +self.call+
|
1790
|
+
#
|
1791
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#92
|
1792
|
+
sig { returns(T.any(::Integer, T::Array[::Integer])) }
|
1793
|
+
def call; end
|
1794
|
+
|
1795
|
+
private
|
1796
|
+
|
1797
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#251
|
1798
|
+
sig { params(char: ::String).void }
|
1799
|
+
def build_selection(char); end
|
1800
|
+
|
1801
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#112
|
1802
|
+
sig { void }
|
1803
|
+
def calculate_option_line_lengths; end
|
1804
|
+
|
1805
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#257
|
1806
|
+
sig { void }
|
1807
|
+
def chop_selection; end
|
1808
|
+
|
1809
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#151
|
1810
|
+
sig { params(number_of_lines: ::Integer).void }
|
1811
|
+
def clear_output(number_of_lines = T.unsafe(nil)); end
|
1812
|
+
|
1813
|
+
# Don't use this in place of +@displaying_metadata+, this updates too
|
1814
|
+
# quickly to be useful when drawing to the screen.
|
1815
|
+
#
|
1816
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#167
|
1817
|
+
sig { returns(T::Boolean) }
|
1818
|
+
def display_metadata?; end
|
1819
|
+
|
1820
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#438
|
1821
|
+
sig { returns(::Integer) }
|
1822
|
+
def distance_from_selection_to_end; end
|
1823
|
+
|
1824
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#443
|
1825
|
+
sig { returns(::Integer) }
|
1826
|
+
def distance_from_start_to_selection; end
|
1827
|
+
|
1828
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#207
|
1829
|
+
sig { void }
|
1830
|
+
def down; end
|
1831
|
+
|
1832
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#458
|
1833
|
+
sig { void }
|
1834
|
+
def ensure_first_item_is_continuation_marker; end
|
1835
|
+
|
1836
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#453
|
1837
|
+
sig { void }
|
1838
|
+
def ensure_last_item_is_continuation_marker; end
|
1839
|
+
|
1840
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#431
|
1841
|
+
sig { void }
|
1842
|
+
def ensure_visible_is_active; end
|
1843
|
+
|
1844
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#358
|
1845
|
+
sig { returns(T::Boolean) }
|
1846
|
+
def filtering?; end
|
1847
|
+
|
1848
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#519
|
1849
|
+
sig { params(format: ::String, choice: ::String).returns(::String) }
|
1850
|
+
def format_choice(format, choice); end
|
1851
|
+
|
1852
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#363
|
1853
|
+
sig { returns(T::Boolean) }
|
1854
|
+
def has_filter?; end
|
1855
|
+
|
1856
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#448
|
1857
|
+
sig { returns(::Integer) }
|
1858
|
+
def index_of_active_option; end
|
1859
|
+
|
1860
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#463
|
1861
|
+
sig { returns(::Integer) }
|
1862
|
+
def max_lines; end
|
1863
|
+
|
1864
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#172
|
1865
|
+
sig { returns(::Integer) }
|
1866
|
+
def num_lines; end
|
1867
|
+
|
1868
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#388
|
1869
|
+
sig { params(recalculate: T::Boolean).returns(T::Array[[::String, T.nilable(::Integer)]]) }
|
1870
|
+
def presented_options(recalculate: T.unsafe(nil)); end
|
1871
|
+
|
1872
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#289
|
1873
|
+
sig { void }
|
1874
|
+
def process_input_until_redraw_required; end
|
1875
|
+
|
1876
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#468
|
1877
|
+
sig { void }
|
1878
|
+
def render_options; end
|
1879
|
+
|
1880
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#142
|
1881
|
+
sig { params(number_of_lines: ::Integer).void }
|
1882
|
+
def reset_position(number_of_lines = T.unsafe(nil)); end
|
1883
|
+
|
1884
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#241
|
1885
|
+
sig { params(char: ::String).void }
|
1886
|
+
def select_bool(char); end
|
1887
|
+
|
1888
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#281
|
1889
|
+
sig { void }
|
1890
|
+
def select_current; end
|
1891
|
+
|
1892
|
+
# n is 1-indexed selection
|
1893
|
+
# n == 0 if "Done" was selected in @multiple mode
|
1894
|
+
#
|
1895
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#220
|
1896
|
+
sig { params(n: ::Integer).void }
|
1897
|
+
def select_n(n); end
|
1898
|
+
|
1899
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#353
|
1900
|
+
sig { returns(T::Boolean) }
|
1901
|
+
def selecting?; end
|
1902
|
+
|
1903
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#368
|
1904
|
+
sig { void }
|
1905
|
+
def start_filter; end
|
1906
|
+
|
1907
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#374
|
1908
|
+
sig { void }
|
1909
|
+
def start_line_select; end
|
1910
|
+
|
1911
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#381
|
1912
|
+
sig { void }
|
1913
|
+
def stop_line_select; end
|
1914
|
+
|
1915
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#186
|
1916
|
+
sig { returns(T::Boolean) }
|
1917
|
+
def terminal_width_changed?; end
|
1918
|
+
|
1919
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#196
|
1920
|
+
sig { void }
|
1921
|
+
def up; end
|
1922
|
+
|
1923
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#263
|
1924
|
+
sig { params(char: ::String).void }
|
1925
|
+
def update_search(char); end
|
1926
|
+
|
1927
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#296
|
1928
|
+
sig { void }
|
1929
|
+
def wait_for_user_input; end
|
1930
|
+
|
1931
|
+
class << self
|
1932
|
+
# Prompts the user with options
|
1933
|
+
# Uses an interactive session to allow the user to pick an answer
|
1934
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
1935
|
+
# For more than 9 options, hitting 'e', ':', or 'G' will enter select
|
1936
|
+
# mode allowing the user to type in longer numbers
|
1937
|
+
# Pressing 'f' or '/' will allow the user to filter the results
|
1938
|
+
#
|
1939
|
+
# https://user-images.githubusercontent.com/3074765/33797984-0ebb5e64-dcdf-11e7-9e7e-7204f279cece.gif
|
1940
|
+
#
|
1941
|
+
# ==== Example Usage:
|
1942
|
+
#
|
1943
|
+
# Ask an interactive question
|
1944
|
+
# CLI::UI::Prompt::InteractiveOptions.call(%w(rails go python))
|
1945
|
+
#
|
1946
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#37
|
1947
|
+
sig do
|
1948
|
+
params(
|
1949
|
+
options: T::Array[::String],
|
1950
|
+
multiple: T::Boolean,
|
1951
|
+
default: T.nilable(T.any(::String, T::Array[::String]))
|
1952
|
+
).returns(T.any(::String, T::Array[::String]))
|
1953
|
+
end
|
1954
|
+
def call(options, multiple: T.unsafe(nil), default: T.unsafe(nil)); end
|
1955
|
+
end
|
1956
|
+
end
|
1957
|
+
|
1958
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#191
|
1959
|
+
CLI::UI::Prompt::InteractiveOptions::BACKSPACE = T.let(T.unsafe(nil), String)
|
1960
|
+
|
1961
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#14
|
1962
|
+
CLI::UI::Prompt::InteractiveOptions::CHECKBOX_ICON = T.let(T.unsafe(nil), Hash)
|
1963
|
+
|
1964
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#192
|
1965
|
+
CLI::UI::Prompt::InteractiveOptions::CTRL_C = T.let(T.unsafe(nil), String)
|
1966
|
+
|
1967
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#193
|
1968
|
+
CLI::UI::Prompt::InteractiveOptions::CTRL_D = T.let(T.unsafe(nil), String)
|
1969
|
+
|
1970
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#13
|
1971
|
+
CLI::UI::Prompt::InteractiveOptions::DONE = T.let(T.unsafe(nil), String)
|
1972
|
+
|
1973
|
+
# source://cli-ui//lib/cli/ui/prompt/interactive_options.rb#190
|
1974
|
+
CLI::UI::Prompt::InteractiveOptions::ESC = T.let(T.unsafe(nil), String)
|
1975
|
+
|
1976
|
+
# A class that handles the various options of an InteractivePrompt and their callbacks
|
1977
|
+
#
|
1978
|
+
# source://cli-ui//lib/cli/ui/prompt/options_handler.rb#8
|
1979
|
+
class CLI::UI::Prompt::OptionsHandler
|
1980
|
+
# source://cli-ui//lib/cli/ui/prompt/options_handler.rb#12
|
1981
|
+
sig { void }
|
1982
|
+
def initialize; end
|
1983
|
+
|
1984
|
+
# source://cli-ui//lib/cli/ui/prompt/options_handler.rb#27
|
1985
|
+
sig { params(options: T.any(::String, T::Array[::String])).returns(::String) }
|
1986
|
+
def call(options); end
|
1987
|
+
|
1988
|
+
# source://cli-ui//lib/cli/ui/prompt/options_handler.rb#22
|
1989
|
+
sig { params(option: ::String, handler: T.proc.params(option: ::String).returns(::String)).void }
|
1990
|
+
def option(option, &handler); end
|
1991
|
+
|
1992
|
+
# source://cli-ui//lib/cli/ui/prompt/options_handler.rb#17
|
1993
|
+
sig { returns(T::Array[::String]) }
|
1994
|
+
def options; end
|
1995
|
+
end
|
1996
|
+
|
1997
|
+
class CLI::UI::ReentrantMutex < ::Thread::Mutex
|
1998
|
+
def initialize; end
|
1999
|
+
|
2000
|
+
def count; end
|
2001
|
+
def lock; end
|
2002
|
+
def synchronize; end
|
2003
|
+
def unlock; end
|
2004
|
+
|
2005
|
+
private
|
2006
|
+
|
2007
|
+
def decrease_count(thread); end
|
2008
|
+
def delete_count(thread); end
|
2009
|
+
def increase_count(thread); end
|
2010
|
+
end
|
2011
|
+
|
2012
|
+
# Convenience accessor to +CLI::UI::Spinner::SpinGroup+
|
2013
|
+
#
|
2014
|
+
# source://cli-ui//lib/cli/ui.rb#29
|
2015
|
+
CLI::UI::SpinGroup = CLI::UI::Spinner::SpinGroup
|
2016
|
+
|
2017
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#8
|
2018
|
+
module CLI::UI::Spinner
|
2019
|
+
class << self
|
2020
|
+
# We use this from CLI::UI::Widgets::Status to render an additional
|
2021
|
+
# spinner next to the "working" element. While this global state looks
|
2022
|
+
# a bit repulsive at first, it's worth realizing that:
|
2023
|
+
#
|
2024
|
+
# * It's managed by the SpinGroup#wait method, not individual tasks; and
|
2025
|
+
# * It would be complete insanity to run two separate but concurrent SpinGroups.
|
2026
|
+
#
|
2027
|
+
# While it would be possible to stitch through some connection between
|
2028
|
+
# the SpinGroup and the Widgets included in its title, this is simpler
|
2029
|
+
# in practice and seems unlikely to cause issues in practice.
|
2030
|
+
#
|
2031
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#44
|
2032
|
+
sig { returns(::String) }
|
2033
|
+
def current_rune; end
|
2034
|
+
|
2035
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#31
|
2036
|
+
sig { returns(T.nilable(::Integer)) }
|
2037
|
+
def index; end
|
2038
|
+
|
2039
|
+
# @return [Integer, nil]
|
2040
|
+
#
|
2041
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#31
|
2042
|
+
def index=(_arg0); end
|
2043
|
+
|
2044
|
+
# Adds a single spinner
|
2045
|
+
# Uses an interactive session to allow the user to pick an answer
|
2046
|
+
# Can use arrows, y/n, numbers (1/2), and vim bindings to control
|
2047
|
+
#
|
2048
|
+
# https://user-images.githubusercontent.com/3074765/33798295-d94fd822-dce3-11e7-819b-43e5502d490e.gif
|
2049
|
+
#
|
2050
|
+
# ==== Attributes
|
2051
|
+
#
|
2052
|
+
# * +title+ - Title of the spinner to use
|
2053
|
+
#
|
2054
|
+
# ==== Options
|
2055
|
+
#
|
2056
|
+
# * +:auto_debrief+ - Automatically debrief exceptions or through success_debrief? Default to true
|
2057
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
2058
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout.
|
2059
|
+
#
|
2060
|
+
# ==== Block
|
2061
|
+
#
|
2062
|
+
# * *spinner+ - Instance of the spinner. Can call +update_title+ to update the user of changes
|
2063
|
+
#
|
2064
|
+
# ==== Example Usage:
|
2065
|
+
#
|
2066
|
+
# CLI::UI::Spinner.spin('Title') { sleep 1.0 }
|
2067
|
+
#
|
2068
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#84
|
2069
|
+
sig do
|
2070
|
+
params(
|
2071
|
+
title: ::String,
|
2072
|
+
auto_debrief: T::Boolean,
|
2073
|
+
to: T.any(::IO, ::StringIO),
|
2074
|
+
block: T.proc.params(task: ::CLI::UI::Spinner::SpinGroup::Task).void
|
2075
|
+
).returns(T::Boolean)
|
2076
|
+
end
|
2077
|
+
def spin(title, auto_debrief: T.unsafe(nil), to: T.unsafe(nil), &block); end
|
2078
|
+
end
|
2079
|
+
end
|
2080
|
+
|
2081
|
+
# source://cli-ui//lib/cli/ui/spinner/async.rb#7
|
2082
|
+
class CLI::UI::Spinner::Async
|
2083
|
+
# Initializes a new asynchronous spinner with no specific end.
|
2084
|
+
# Must call +.stop+ to end the spinner
|
2085
|
+
#
|
2086
|
+
# ==== Attributes
|
2087
|
+
#
|
2088
|
+
# * +title+ - Title of the spinner to use
|
2089
|
+
#
|
2090
|
+
# ==== Example Usage:
|
2091
|
+
#
|
2092
|
+
# CLI::UI::Spinner::Async.new('Title')
|
2093
|
+
#
|
2094
|
+
# source://cli-ui//lib/cli/ui/spinner/async.rb#33
|
2095
|
+
sig { params(title: ::String).void }
|
2096
|
+
def initialize(title); end
|
2097
|
+
|
2098
|
+
# Stops an asynchronous spinner
|
2099
|
+
#
|
2100
|
+
# source://cli-ui//lib/cli/ui/spinner/async.rb#45
|
2101
|
+
sig { returns(T::Boolean) }
|
2102
|
+
def stop; end
|
2103
|
+
|
2104
|
+
class << self
|
2105
|
+
# Convenience method for +initialize+
|
2106
|
+
#
|
2107
|
+
# source://cli-ui//lib/cli/ui/spinner/async.rb#16
|
2108
|
+
sig { params(title: ::String).returns(::CLI::UI::Spinner::Async) }
|
2109
|
+
def start(title); end
|
2110
|
+
end
|
2111
|
+
end
|
2112
|
+
|
2113
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#25
|
2114
|
+
CLI::UI::Spinner::GLYPHS = T.let(T.unsafe(nil), Array)
|
2115
|
+
|
2116
|
+
# seconds
|
2117
|
+
#
|
2118
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#14
|
2119
|
+
CLI::UI::Spinner::PERIOD = T.let(T.unsafe(nil), Float)
|
2120
|
+
|
2121
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#17
|
2122
|
+
CLI::UI::Spinner::RUNES = T.let(T.unsafe(nil), Array)
|
2123
|
+
|
2124
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#9
|
2125
|
+
class CLI::UI::Spinner::SpinGroup
|
2126
|
+
# Initializes a new spin group
|
2127
|
+
# This lets you add +Task+ objects to the group to multi-thread work
|
2128
|
+
#
|
2129
|
+
# ==== Options
|
2130
|
+
#
|
2131
|
+
# * +:auto_debrief+ - Automatically debrief exceptions or through success_debrief? Default to true
|
2132
|
+
# * +:interrupt_debrief+ - Automatically debrief on interrupt. Default to false
|
2133
|
+
# * +:max_concurrent+ - Maximum number of concurrent tasks. Default is 0 (effectively unlimited)
|
2134
|
+
# * +:work_queue+ - Custom WorkQueue instance. If not provided, a new one will be created
|
2135
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
2136
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout
|
2137
|
+
#
|
2138
|
+
# ==== Example Usage
|
2139
|
+
#
|
2140
|
+
# CLI::UI::SpinGroup.new do |spin_group|
|
2141
|
+
# spin_group.add('Title') { |spinner| sleep 3.0 }
|
2142
|
+
# spin_group.add('Title 2') { |spinner| sleep 3.0; spinner.update_title('New Title'); sleep 3.0 }
|
2143
|
+
# end
|
2144
|
+
#
|
2145
|
+
# Output:
|
2146
|
+
#
|
2147
|
+
# https://user-images.githubusercontent.com/3074765/33798558-c452fa26-dce8-11e7-9e90-b4b34df21a46.gif
|
2148
|
+
#
|
2149
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#79
|
2150
|
+
sig do
|
2151
|
+
params(
|
2152
|
+
auto_debrief: T::Boolean,
|
2153
|
+
interrupt_debrief: T::Boolean,
|
2154
|
+
max_concurrent: ::Integer,
|
2155
|
+
work_queue: T.nilable(::CLI::UI::WorkQueue),
|
2156
|
+
to: T.any(::IO, ::StringIO)
|
2157
|
+
).void
|
2158
|
+
end
|
2159
|
+
def initialize(auto_debrief: T.unsafe(nil), interrupt_debrief: T.unsafe(nil), max_concurrent: T.unsafe(nil), work_queue: T.unsafe(nil), to: T.unsafe(nil)); end
|
2160
|
+
|
2161
|
+
# Add a new task
|
2162
|
+
#
|
2163
|
+
# ==== Attributes
|
2164
|
+
#
|
2165
|
+
# * +title+ - Title of the task
|
2166
|
+
# * +block+ - Block for the task, will be provided with an instance of the spinner
|
2167
|
+
#
|
2168
|
+
# ==== Example Usage:
|
2169
|
+
# spin_group = CLI::UI::SpinGroup.new
|
2170
|
+
# spin_group.add('Title') { |spinner| sleep 1.0 }
|
2171
|
+
# spin_group.wait
|
2172
|
+
#
|
2173
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#307
|
2174
|
+
sig do
|
2175
|
+
params(
|
2176
|
+
title: ::String,
|
2177
|
+
final_glyph: T.proc.params(success: T::Boolean).returns(T.any(::CLI::UI::Glyph, ::String)),
|
2178
|
+
merged_output: T::Boolean,
|
2179
|
+
duplicate_output_to: ::IO,
|
2180
|
+
block: T.proc.params(task: ::CLI::UI::Spinner::SpinGroup::Task).void
|
2181
|
+
).void
|
2182
|
+
end
|
2183
|
+
def add(title, final_glyph: T.unsafe(nil), merged_output: T.unsafe(nil), duplicate_output_to: T.unsafe(nil), &block); end
|
2184
|
+
|
2185
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#480
|
2186
|
+
sig { returns(T::Boolean) }
|
2187
|
+
def all_succeeded?; end
|
2188
|
+
|
2189
|
+
# Debriefs failed tasks is +auto_debrief+ is true
|
2190
|
+
#
|
2191
|
+
# ==== Options
|
2192
|
+
#
|
2193
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
2194
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout
|
2195
|
+
#
|
2196
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#494
|
2197
|
+
sig { params(to: T.any(::IO, ::StringIO)).returns(T::Boolean) }
|
2198
|
+
def debrief(to: T.unsafe(nil)); end
|
2199
|
+
|
2200
|
+
# Provide an alternative debriefing for failed tasks
|
2201
|
+
#
|
2202
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#465
|
2203
|
+
sig do
|
2204
|
+
params(
|
2205
|
+
block: T.proc.params(title: ::String, exception: T.nilable(::Exception), out: ::String, err: ::String).void
|
2206
|
+
).void
|
2207
|
+
end
|
2208
|
+
def failure_debrief(&block); end
|
2209
|
+
|
2210
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#453
|
2211
|
+
sig { params(message: ::String).void }
|
2212
|
+
def puts_above(message); end
|
2213
|
+
|
2214
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#327
|
2215
|
+
sig { void }
|
2216
|
+
def stop; end
|
2217
|
+
|
2218
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#346
|
2219
|
+
sig { returns(T::Boolean) }
|
2220
|
+
def stopped?; end
|
2221
|
+
|
2222
|
+
# Provide a debriefing for successful tasks
|
2223
|
+
#
|
2224
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#475
|
2225
|
+
sig { params(block: T.proc.params(title: ::String, out: ::String, err: ::String).void).void }
|
2226
|
+
def success_debrief(&block); end
|
2227
|
+
|
2228
|
+
# Tells the group you're done adding tasks and to wait for all of them to finish
|
2229
|
+
#
|
2230
|
+
# ==== Options
|
2231
|
+
#
|
2232
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
2233
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout
|
2234
|
+
#
|
2235
|
+
# ==== Example Usage:
|
2236
|
+
# spin_group = CLI::UI::SpinGroup.new
|
2237
|
+
# spin_group.add('Title') { |spinner| sleep 1.0 }
|
2238
|
+
# spin_group.wait
|
2239
|
+
#
|
2240
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#367
|
2241
|
+
sig { params(to: T.any(::IO, ::StringIO)).returns(T::Boolean) }
|
2242
|
+
def wait(to: T.unsafe(nil)); end
|
2243
|
+
|
2244
|
+
class << self
|
2245
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#16
|
2246
|
+
sig { returns(::Thread::Mutex) }
|
2247
|
+
def pause_mutex; end
|
2248
|
+
|
2249
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#28
|
2250
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2251
|
+
def pause_spinners(&block); end
|
2252
|
+
|
2253
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#19
|
2254
|
+
sig { returns(T::Boolean) }
|
2255
|
+
def paused?; end
|
2256
|
+
end
|
2257
|
+
end
|
2258
|
+
|
2259
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#10
|
2260
|
+
CLI::UI::Spinner::SpinGroup::DEFAULT_FINAL_GLYPH = T.let(T.unsafe(nil), Proc)
|
2261
|
+
|
2262
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#98
|
2263
|
+
class CLI::UI::Spinner::SpinGroup::Task
|
2264
|
+
# Initializes a new Task
|
2265
|
+
# This is managed entirely internally by +SpinGroup+
|
2266
|
+
#
|
2267
|
+
# ==== Attributes
|
2268
|
+
#
|
2269
|
+
# * +title+ - Title of the task
|
2270
|
+
# * +block+ - Block for the task, will be provided with an instance of the spinner
|
2271
|
+
#
|
2272
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#131
|
2273
|
+
sig do
|
2274
|
+
params(
|
2275
|
+
title: ::String,
|
2276
|
+
final_glyph: T.proc.params(success: T::Boolean).returns(T.any(::CLI::UI::Glyph, ::String)),
|
2277
|
+
merged_output: T::Boolean,
|
2278
|
+
duplicate_output_to: ::IO,
|
2279
|
+
work_queue: ::CLI::UI::WorkQueue,
|
2280
|
+
block: T.proc.params(task: ::CLI::UI::Spinner::SpinGroup::Task).returns(T.untyped)
|
2281
|
+
).void
|
2282
|
+
end
|
2283
|
+
def initialize(title, final_glyph:, merged_output:, duplicate_output_to:, work_queue:, &block); end
|
2284
|
+
|
2285
|
+
# Checks if a task is finished
|
2286
|
+
#
|
2287
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#162
|
2288
|
+
sig { returns(T::Boolean) }
|
2289
|
+
def check; end
|
2290
|
+
|
2291
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#108
|
2292
|
+
sig { returns(T::Boolean) }
|
2293
|
+
def done; end
|
2294
|
+
|
2295
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#111
|
2296
|
+
sig { returns(T.nilable(::Exception)) }
|
2297
|
+
def exception; end
|
2298
|
+
|
2299
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#155
|
2300
|
+
sig { params(block: T.proc.params(task: ::CLI::UI::Spinner::SpinGroup::Task).void).void }
|
2301
|
+
def on_done(&block); end
|
2302
|
+
|
2303
|
+
# Re-renders the task if required:
|
2304
|
+
#
|
2305
|
+
# We try to be as lazy as possible in re-rendering the full line. The
|
2306
|
+
# spinner rune will change on each render for the most part, but the
|
2307
|
+
# body text will rarely have changed. If the body text *has* changed,
|
2308
|
+
# we set @force_full_render.
|
2309
|
+
#
|
2310
|
+
# Further, if the title string includes any CLI::UI::Widgets, we
|
2311
|
+
# assume that it may change from render to render, since those
|
2312
|
+
# evaluate more dynamically than the rest of our format codes, which
|
2313
|
+
# are just text formatters. This is controlled by @always_full_render.
|
2314
|
+
#
|
2315
|
+
# ==== Attributes
|
2316
|
+
#
|
2317
|
+
# * +index+ - index of the task
|
2318
|
+
# * +force+ - force rerender of the task
|
2319
|
+
# * +width+ - current terminal width to format for
|
2320
|
+
#
|
2321
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#200
|
2322
|
+
sig { params(index: ::Integer, force: T::Boolean, width: ::Integer).returns(::String) }
|
2323
|
+
def render(index, force = T.unsafe(nil), width: T.unsafe(nil)); end
|
2324
|
+
|
2325
|
+
# @return [String]
|
2326
|
+
#
|
2327
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#102
|
2328
|
+
def stderr; end
|
2329
|
+
|
2330
|
+
# @return [String]
|
2331
|
+
#
|
2332
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#102
|
2333
|
+
def stdout; end
|
2334
|
+
|
2335
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#105
|
2336
|
+
sig { returns(T::Boolean) }
|
2337
|
+
def success; end
|
2338
|
+
|
2339
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#102
|
2340
|
+
sig { returns(::String) }
|
2341
|
+
def title; end
|
2342
|
+
|
2343
|
+
# Update the spinner title
|
2344
|
+
#
|
2345
|
+
# ==== Attributes
|
2346
|
+
#
|
2347
|
+
# * +title+ - title to change the spinner to
|
2348
|
+
#
|
2349
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#219
|
2350
|
+
sig { params(new_title: ::String).void }
|
2351
|
+
def update_title(new_title); end
|
2352
|
+
|
2353
|
+
private
|
2354
|
+
|
2355
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#230
|
2356
|
+
sig { params(index: ::Integer, terminal_width: ::Integer).returns(::String) }
|
2357
|
+
def full_render(index, terminal_width); end
|
2358
|
+
|
2359
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#256
|
2360
|
+
sig { params(index: ::Integer).returns(::String) }
|
2361
|
+
def glyph(index); end
|
2362
|
+
|
2363
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#276
|
2364
|
+
sig { returns(::String) }
|
2365
|
+
def inset; end
|
2366
|
+
|
2367
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#281
|
2368
|
+
sig { returns(::Integer) }
|
2369
|
+
def inset_width; end
|
2370
|
+
|
2371
|
+
# source://cli-ui//lib/cli/ui/spinner/spin_group.rb#246
|
2372
|
+
sig { params(index: ::Integer).returns(::String) }
|
2373
|
+
def partial_render(index); end
|
2374
|
+
end
|
2375
|
+
|
2376
|
+
# source://cli-ui//lib/cli/ui/spinner.rb#15
|
2377
|
+
CLI::UI::Spinner::TASK_FAILED = T.let(T.unsafe(nil), Symbol)
|
2378
|
+
|
2379
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#10
|
2380
|
+
module CLI::UI::StdoutRouter
|
2381
|
+
class << self
|
2382
|
+
# @raise [NotEnabled]
|
2383
|
+
#
|
2384
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#352
|
2385
|
+
sig { void }
|
2386
|
+
def assert_enabled!; end
|
2387
|
+
|
2388
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#347
|
2389
|
+
sig { returns(T.nilable(T::Hash[::Symbol, T.any(::IO, ::String, ::StringIO)])) }
|
2390
|
+
def current_id; end
|
2391
|
+
|
2392
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#385
|
2393
|
+
sig { returns(T::Boolean) }
|
2394
|
+
def disable; end
|
2395
|
+
|
2396
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#327
|
2397
|
+
sig { returns(T.nilable(T.any(::IO, ::StringIO))) }
|
2398
|
+
def duplicate_output_to; end
|
2399
|
+
|
2400
|
+
# @return [IOLike, nil]
|
2401
|
+
#
|
2402
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#327
|
2403
|
+
def duplicate_output_to=(_arg0); end
|
2404
|
+
|
2405
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#371
|
2406
|
+
sig { returns(T::Boolean) }
|
2407
|
+
def enable; end
|
2408
|
+
|
2409
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#380
|
2410
|
+
sig { params(stream: T.any(::IO, ::StringIO)).returns(T::Boolean) }
|
2411
|
+
def enabled?(stream = T.unsafe(nil)); end
|
2412
|
+
|
2413
|
+
# TODO: remove this
|
2414
|
+
#
|
2415
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#366
|
2416
|
+
sig { void }
|
2417
|
+
def ensure_activated; end
|
2418
|
+
|
2419
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#357
|
2420
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2421
|
+
def with_enabled(&block); end
|
2422
|
+
|
2423
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#334
|
2424
|
+
sig do
|
2425
|
+
type_parameters(:T)
|
2426
|
+
.params(
|
2427
|
+
on_streams: T::Array[T.any(::IO, ::StringIO)],
|
2428
|
+
block: T.proc.params(id: ::String).returns(T.type_parameter(:T))
|
2429
|
+
).returns(T.type_parameter(:T))
|
2430
|
+
end
|
2431
|
+
def with_id(on_streams:, &block); end
|
2432
|
+
|
2433
|
+
private
|
2434
|
+
|
2435
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#403
|
2436
|
+
sig { params(stream: T.any(::IO, ::StringIO), streamname: ::Symbol).void }
|
2437
|
+
def activate(stream, streamname); end
|
2438
|
+
|
2439
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#396
|
2440
|
+
sig { params(stream: T.any(::IO, ::StringIO)).void }
|
2441
|
+
def deactivate(stream); end
|
2442
|
+
end
|
2443
|
+
end
|
2444
|
+
|
2445
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#94
|
2446
|
+
class CLI::UI::StdoutRouter::Capture
|
2447
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#196
|
2448
|
+
sig do
|
2449
|
+
params(
|
2450
|
+
with_frame_inset: T::Boolean,
|
2451
|
+
merged_output: T::Boolean,
|
2452
|
+
duplicate_output_to: ::IO,
|
2453
|
+
block: T.proc.void
|
2454
|
+
).void
|
2455
|
+
end
|
2456
|
+
def initialize(with_frame_inset: T.unsafe(nil), merged_output: T.unsafe(nil), duplicate_output_to: T.unsafe(nil), &block); end
|
2457
|
+
|
2458
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#212
|
2459
|
+
sig { returns(T::Boolean) }
|
2460
|
+
def print_captured_output; end
|
2461
|
+
|
2462
|
+
# @return [Boolean]
|
2463
|
+
#
|
2464
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#212
|
2465
|
+
def print_captured_output=(_arg0); end
|
2466
|
+
|
2467
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#215
|
2468
|
+
sig { returns(T.untyped) }
|
2469
|
+
def run; end
|
2470
|
+
|
2471
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#258
|
2472
|
+
sig { returns(::String) }
|
2473
|
+
def stderr; end
|
2474
|
+
|
2475
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#253
|
2476
|
+
sig { returns(::String) }
|
2477
|
+
def stdout; end
|
2478
|
+
|
2479
|
+
class << self
|
2480
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#106
|
2481
|
+
sig { returns(T.nilable(::CLI::UI::StdoutRouter::Capture)) }
|
2482
|
+
def current_capture; end
|
2483
|
+
|
2484
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#111
|
2485
|
+
sig { returns(::CLI::UI::StdoutRouter::Capture) }
|
2486
|
+
def current_capture!; end
|
2487
|
+
|
2488
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#116
|
2489
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2490
|
+
def in_alternate_screen(&block); end
|
2491
|
+
|
2492
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#143
|
2493
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2494
|
+
def stdin_synchronize(&block); end
|
2495
|
+
|
2496
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#157
|
2497
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2498
|
+
def with_stdin_masked(&block); end
|
2499
|
+
|
2500
|
+
private
|
2501
|
+
|
2502
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#183
|
2503
|
+
sig { returns(T::Boolean) }
|
2504
|
+
def outermost_uncaptured?; end
|
2505
|
+
end
|
2506
|
+
end
|
2507
|
+
|
2508
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#262
|
2509
|
+
class CLI::UI::StdoutRouter::Capture::BlockingInput
|
2510
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#266
|
2511
|
+
sig { params(stream: ::IO).void }
|
2512
|
+
def initialize(stream); end
|
2513
|
+
|
2514
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2515
|
+
def <<(*args, **kwargs, &block); end
|
2516
|
+
|
2517
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2518
|
+
def advise(*args, **kwargs, &block); end
|
2519
|
+
|
2520
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2521
|
+
def autoclose=(*args, **kwargs, &block); end
|
2522
|
+
|
2523
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2524
|
+
def autoclose?(*args, **kwargs, &block); end
|
2525
|
+
|
2526
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2527
|
+
def binmode(*args, **kwargs, &block); end
|
2528
|
+
|
2529
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2530
|
+
def binmode?(*args, **kwargs, &block); end
|
2531
|
+
|
2532
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2533
|
+
def close(*args, **kwargs, &block); end
|
2534
|
+
|
2535
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2536
|
+
def close_on_exec=(*args, **kwargs, &block); end
|
2537
|
+
|
2538
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2539
|
+
def close_on_exec?(*args, **kwargs, &block); end
|
2540
|
+
|
2541
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2542
|
+
def close_read(*args, **kwargs, &block); end
|
2543
|
+
|
2544
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2545
|
+
def close_write(*args, **kwargs, &block); end
|
2546
|
+
|
2547
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2548
|
+
def closed?(*args, **kwargs, &block); end
|
2549
|
+
|
2550
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2551
|
+
def each(*args, **kwargs, &block); end
|
2552
|
+
|
2553
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2554
|
+
def each_byte(*args, **kwargs, &block); end
|
2555
|
+
|
2556
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2557
|
+
def each_char(*args, **kwargs, &block); end
|
2558
|
+
|
2559
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2560
|
+
def each_codepoint(*args, **kwargs, &block); end
|
2561
|
+
|
2562
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2563
|
+
def each_line(*args, **kwargs, &block); end
|
2564
|
+
|
2565
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2566
|
+
def eof(*args, **kwargs, &block); end
|
2567
|
+
|
2568
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2569
|
+
def eof?(*args, **kwargs, &block); end
|
2570
|
+
|
2571
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2572
|
+
def external_encoding(*args, **kwargs, &block); end
|
2573
|
+
|
2574
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2575
|
+
def fcntl(*args, **kwargs, &block); end
|
2576
|
+
|
2577
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2578
|
+
def fdatasync(*args, **kwargs, &block); end
|
2579
|
+
|
2580
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2581
|
+
def fileno(*args, **kwargs, &block); end
|
2582
|
+
|
2583
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2584
|
+
def flush(*args, **kwargs, &block); end
|
2585
|
+
|
2586
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2587
|
+
def fsync(*args, **kwargs, &block); end
|
2588
|
+
|
2589
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2590
|
+
def getbyte(*args, **kwargs, &block); end
|
2591
|
+
|
2592
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2593
|
+
def getc(*args, **kwargs, &block); end
|
2594
|
+
|
2595
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2596
|
+
def getch(*args, **kwargs, &block); end
|
2597
|
+
|
2598
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2599
|
+
def gets(*args, **kwargs, &block); end
|
2600
|
+
|
2601
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2602
|
+
def inspect(*args, **kwargs, &block); end
|
2603
|
+
|
2604
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2605
|
+
def internal_encoding(*args, **kwargs, &block); end
|
2606
|
+
|
2607
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2608
|
+
def ioctl(*args, **kwargs, &block); end
|
2609
|
+
|
2610
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2611
|
+
def isatty(*args, **kwargs, &block); end
|
2612
|
+
|
2613
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2614
|
+
def lineno(*args, **kwargs, &block); end
|
2615
|
+
|
2616
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2617
|
+
def lineno=(*args, **kwargs, &block); end
|
2618
|
+
|
2619
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2620
|
+
def nread(*args, **kwargs, &block); end
|
2621
|
+
|
2622
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2623
|
+
def path(*args, **kwargs, &block); end
|
2624
|
+
|
2625
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2626
|
+
def pathconf(*args, **kwargs, &block); end
|
2627
|
+
|
2628
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2629
|
+
def pid(*args, **kwargs, &block); end
|
2630
|
+
|
2631
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2632
|
+
def pos(*args, **kwargs, &block); end
|
2633
|
+
|
2634
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2635
|
+
def pos=(*args, **kwargs, &block); end
|
2636
|
+
|
2637
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2638
|
+
def pread(*args, **kwargs, &block); end
|
2639
|
+
|
2640
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2641
|
+
def print(*args, **kwargs, &block); end
|
2642
|
+
|
2643
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2644
|
+
def printf(*args, **kwargs, &block); end
|
2645
|
+
|
2646
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2647
|
+
def putc(*args, **kwargs, &block); end
|
2648
|
+
|
2649
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2650
|
+
def puts(*args, **kwargs, &block); end
|
2651
|
+
|
2652
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2653
|
+
def pwrite(*args, **kwargs, &block); end
|
2654
|
+
|
2655
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2656
|
+
def read(*args, **kwargs, &block); end
|
2657
|
+
|
2658
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2659
|
+
def read_nonblock(*args, **kwargs, &block); end
|
2660
|
+
|
2661
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2662
|
+
def readbyte(*args, **kwargs, &block); end
|
2663
|
+
|
2664
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2665
|
+
def readchar(*args, **kwargs, &block); end
|
2666
|
+
|
2667
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2668
|
+
def readline(*args, **kwargs, &block); end
|
2669
|
+
|
2670
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2671
|
+
def readlines(*args, **kwargs, &block); end
|
2672
|
+
|
2673
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#304
|
2674
|
+
def readpartial(*args, **kwargs, &block); end
|
2675
|
+
|
2676
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2677
|
+
def ready?(*args, **kwargs, &block); end
|
2678
|
+
|
2679
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2680
|
+
def reopen(*args, **kwargs, &block); end
|
2681
|
+
|
2682
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2683
|
+
def rewind(*args, **kwargs, &block); end
|
2684
|
+
|
2685
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2686
|
+
def seek(*args, **kwargs, &block); end
|
2687
|
+
|
2688
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2689
|
+
def set_encoding(*args, **kwargs, &block); end
|
2690
|
+
|
2691
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2692
|
+
def set_encoding_by_bom(*args, **kwargs, &block); end
|
2693
|
+
|
2694
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2695
|
+
def stat(*args, **kwargs, &block); end
|
2696
|
+
|
2697
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2698
|
+
def sync(*args, **kwargs, &block); end
|
2699
|
+
|
2700
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2701
|
+
def sync=(*args, **kwargs, &block); end
|
2702
|
+
|
2703
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#272
|
2704
|
+
sig { type_parameters(:T).params(block: T.proc.returns(T.type_parameter(:T))).returns(T.type_parameter(:T)) }
|
2705
|
+
def synchronize(&block); end
|
2706
|
+
|
2707
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2708
|
+
def sysread(*args, **kwargs, &block); end
|
2709
|
+
|
2710
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2711
|
+
def sysseek(*args, **kwargs, &block); end
|
2712
|
+
|
2713
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2714
|
+
def syswrite(*args, **kwargs, &block); end
|
2715
|
+
|
2716
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2717
|
+
def tell(*args, **kwargs, &block); end
|
2718
|
+
|
2719
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2720
|
+
def timeout(*args, **kwargs, &block); end
|
2721
|
+
|
2722
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2723
|
+
def timeout=(*args, **kwargs, &block); end
|
2724
|
+
|
2725
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2726
|
+
def to_i(*args, **kwargs, &block); end
|
2727
|
+
|
2728
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2729
|
+
def to_io(*args, **kwargs, &block); end
|
2730
|
+
|
2731
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2732
|
+
def to_path(*args, **kwargs, &block); end
|
2733
|
+
|
2734
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2735
|
+
def tty?(*args, **kwargs, &block); end
|
2736
|
+
|
2737
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2738
|
+
def ungetbyte(*args, **kwargs, &block); end
|
2739
|
+
|
2740
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2741
|
+
def ungetc(*args, **kwargs, &block); end
|
2742
|
+
|
2743
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2744
|
+
def wait(*args, **kwargs, &block); end
|
2745
|
+
|
2746
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2747
|
+
def wait_priority(*args, **kwargs, &block); end
|
2748
|
+
|
2749
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2750
|
+
def wait_readable(*args, **kwargs, &block); end
|
2751
|
+
|
2752
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2753
|
+
def wait_writable(*args, **kwargs, &block); end
|
2754
|
+
|
2755
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2756
|
+
def write(*args, **kwargs, &block); end
|
2757
|
+
|
2758
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#312
|
2759
|
+
def write_nonblock(*args, **kwargs, &block); end
|
2760
|
+
end
|
2761
|
+
|
2762
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#301
|
2763
|
+
CLI::UI::StdoutRouter::Capture::BlockingInput::NON_READING_METHODS = T.let(T.unsafe(nil), Array)
|
2764
|
+
|
2765
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#282
|
2766
|
+
CLI::UI::StdoutRouter::Capture::BlockingInput::READING_METHODS = T.let(T.unsafe(nil), Array)
|
2767
|
+
|
2768
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#11
|
2769
|
+
class CLI::UI::StdoutRouter::Writer
|
2770
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#15
|
2771
|
+
sig { params(stream: T.any(::IO, ::StringIO), name: ::Symbol).void }
|
2772
|
+
def initialize(stream, name); end
|
2773
|
+
|
2774
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#21
|
2775
|
+
sig { params(args: ::Object).returns(::Integer) }
|
2776
|
+
def write(*args); end
|
2777
|
+
|
2778
|
+
private
|
2779
|
+
|
2780
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#77
|
2781
|
+
sig { params(str: ::String, prefix: ::String).returns(::String) }
|
2782
|
+
def apply_line_prefix(str, prefix); end
|
2783
|
+
|
2784
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#72
|
2785
|
+
sig { returns(T::Boolean) }
|
2786
|
+
def auto_frame_inset?; end
|
2787
|
+
|
2788
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#53
|
2789
|
+
sig { params(stream: T.any(::IO, ::StringIO), args: T::Array[::String]).returns(T::Array[::String]) }
|
2790
|
+
def prepend_id(stream, args); end
|
2791
|
+
|
2792
|
+
# source://cli-ui//lib/cli/ui/stdout_router.rb#64
|
2793
|
+
sig { params(stream: T.any(::IO, ::StringIO)).returns(T::Boolean) }
|
2794
|
+
def prepend_id_for_stream(stream); end
|
2795
|
+
end
|
2796
|
+
|
2797
|
+
# source://cli-ui//lib/cli/ui/table.rb#5
|
2798
|
+
module CLI::UI::Table
|
2799
|
+
class << self
|
2800
|
+
# Captures a table's output as an array of strings without printing to the terminal
|
2801
|
+
# Can be used to further manipulate or format the table output
|
2802
|
+
#
|
2803
|
+
# ==== Attributes
|
2804
|
+
#
|
2805
|
+
# * +table+ - (required) 2D array of strings representing the table data
|
2806
|
+
#
|
2807
|
+
# ==== Options
|
2808
|
+
#
|
2809
|
+
# * +:col_spacing+ - Number of spaces between columns. Defaults to 1
|
2810
|
+
#
|
2811
|
+
# ==== Returns
|
2812
|
+
#
|
2813
|
+
# * +Array[String]+ - Array of strings, each representing a row of the formatted table
|
2814
|
+
#
|
2815
|
+
# ==== Example
|
2816
|
+
#
|
2817
|
+
# CLI::UI::Table.capture_table([
|
2818
|
+
# ["{{bold:header_1}}", "{{bold:header_2}}"],
|
2819
|
+
# ["really_long_cell", "short"],
|
2820
|
+
# ["row2", "row2"]
|
2821
|
+
# ])
|
2822
|
+
#
|
2823
|
+
# source://cli-ui//lib/cli/ui/table.rb#79
|
2824
|
+
sig { params(table: T::Array[T::Array[::String]], col_spacing: ::Integer).returns(T::Array[::String]) }
|
2825
|
+
def capture_table(table, col_spacing: T.unsafe(nil)); end
|
2826
|
+
|
2827
|
+
# Prints a formatted table to the specified output
|
2828
|
+
# Automatically pads columns to align based on the longest cell in each column,
|
2829
|
+
# ignoring the width of ANSI color codes.
|
2830
|
+
#
|
2831
|
+
# ==== Attributes
|
2832
|
+
#
|
2833
|
+
# * +table+ - (required) 2D array of strings representing the table data
|
2834
|
+
#
|
2835
|
+
# ==== Options
|
2836
|
+
#
|
2837
|
+
# * +:col_spacing+ - Number of spaces between columns. Defaults to 1
|
2838
|
+
# * +:to+ - Target stream, like $stdout or $stderr. Can be anything with print and puts methods,
|
2839
|
+
# or under Sorbet, IO or StringIO. Defaults to $stdout
|
2840
|
+
#
|
2841
|
+
# ==== Example
|
2842
|
+
#
|
2843
|
+
# CLI::UI::Table.puts_table([
|
2844
|
+
# ["{{bold:header_1}}", "{{bold:header_2}}"],
|
2845
|
+
# ["really_long_cell", "short"],
|
2846
|
+
# ["row2", "row2"]
|
2847
|
+
# ])
|
2848
|
+
#
|
2849
|
+
# Default Output:
|
2850
|
+
# header_1 header_2
|
2851
|
+
# really_long_cell short
|
2852
|
+
# row2 row2
|
2853
|
+
#
|
2854
|
+
# source://cli-ui//lib/cli/ui/table.rb#39
|
2855
|
+
sig { params(table: T::Array[T::Array[::String]], col_spacing: ::Integer, to: T.any(::IO, ::StringIO)).void }
|
2856
|
+
def puts_table(table, col_spacing: T.unsafe(nil), to: T.unsafe(nil)); end
|
2857
|
+
end
|
2858
|
+
end
|
2859
|
+
|
2860
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#9
|
2861
|
+
module CLI::UI::Terminal
|
2862
|
+
class << self
|
2863
|
+
# Returns the width of the terminal, if possible
|
2864
|
+
# Otherwise, will return DEFAULT_HEIGHT
|
2865
|
+
#
|
2866
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#30
|
2867
|
+
sig { returns(::Integer) }
|
2868
|
+
def height; end
|
2869
|
+
|
2870
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#51
|
2871
|
+
sig { void }
|
2872
|
+
def setup_winsize_trap; end
|
2873
|
+
|
2874
|
+
# Returns the width of the terminal, if possible
|
2875
|
+
# Otherwise will return DEFAULT_WIDTH
|
2876
|
+
#
|
2877
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#22
|
2878
|
+
sig { returns(::Integer) }
|
2879
|
+
def width; end
|
2880
|
+
|
2881
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#35
|
2882
|
+
sig { returns([::Integer, ::Integer]) }
|
2883
|
+
def winsize; end
|
2884
|
+
end
|
2885
|
+
end
|
2886
|
+
|
2887
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#13
|
2888
|
+
CLI::UI::Terminal::DEFAULT_HEIGHT = T.let(T.unsafe(nil), Integer)
|
2889
|
+
|
2890
|
+
# source://cli-ui//lib/cli/ui/terminal.rb#12
|
2891
|
+
CLI::UI::Terminal::DEFAULT_WIDTH = T.let(T.unsafe(nil), Integer)
|
2892
|
+
|
2893
|
+
# Truncater truncates a string to a provided printable width.
|
2894
|
+
#
|
2895
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#9
|
2896
|
+
module CLI::UI::Truncater
|
2897
|
+
class << self
|
2898
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#34
|
2899
|
+
sig { params(text: ::String, printing_width: ::Integer).returns(::String) }
|
2900
|
+
def call(text, printing_width); end
|
2901
|
+
|
2902
|
+
private
|
2903
|
+
|
2904
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#96
|
2905
|
+
sig { params(printable_codepoint: ::Integer).returns(::Integer) }
|
2906
|
+
def width(printable_codepoint); end
|
2907
|
+
end
|
2908
|
+
end
|
2909
|
+
|
2910
|
+
# EMOJI_RANGE in particular is super inaccurate. This is best-effort.
|
2911
|
+
# If you need this to be more accurate, we'll almost certainly accept a
|
2912
|
+
# PR improving it.
|
2913
|
+
#
|
2914
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#23
|
2915
|
+
CLI::UI::Truncater::EMOJI_RANGE = T.let(T.unsafe(nil), Range)
|
2916
|
+
|
2917
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#15
|
2918
|
+
CLI::UI::Truncater::ESC = T.let(T.unsafe(nil), Integer)
|
2919
|
+
|
2920
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#25
|
2921
|
+
CLI::UI::Truncater::LC_ALPHA_RANGE = T.let(T.unsafe(nil), Range)
|
2922
|
+
|
2923
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#16
|
2924
|
+
CLI::UI::Truncater::LEFT_SQUARE_BRACKET = T.let(T.unsafe(nil), Integer)
|
2925
|
+
|
2926
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#24
|
2927
|
+
CLI::UI::Truncater::NUMERIC_RANGE = T.let(T.unsafe(nil), Range)
|
2928
|
+
|
2929
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#11
|
2930
|
+
CLI::UI::Truncater::PARSE_ANSI = T.let(T.unsafe(nil), Symbol)
|
2931
|
+
|
2932
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#12
|
2933
|
+
CLI::UI::Truncater::PARSE_ESC = T.let(T.unsafe(nil), Symbol)
|
2934
|
+
|
2935
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#10
|
2936
|
+
CLI::UI::Truncater::PARSE_ROOT = T.let(T.unsafe(nil), Symbol)
|
2937
|
+
|
2938
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#13
|
2939
|
+
CLI::UI::Truncater::PARSE_ZWJ = T.let(T.unsafe(nil), Symbol)
|
2940
|
+
|
2941
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#18
|
2942
|
+
CLI::UI::Truncater::SEMICOLON = T.let(T.unsafe(nil), Integer)
|
2943
|
+
|
2944
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#28
|
2945
|
+
CLI::UI::Truncater::TRUNCATED = T.let(T.unsafe(nil), String)
|
2946
|
+
|
2947
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#26
|
2948
|
+
CLI::UI::Truncater::UC_ALPHA_RANGE = T.let(T.unsafe(nil), Range)
|
2949
|
+
|
2950
|
+
# emojipedia.org/emoji-zwj-sequences
|
2951
|
+
#
|
2952
|
+
# source://cli-ui//lib/cli/ui/truncater.rb#17
|
2953
|
+
CLI::UI::Truncater::ZWJ = T.let(T.unsafe(nil), Integer)
|
2954
|
+
|
2955
|
+
# Widgets are formatter objects with more custom implementations than the
|
2956
|
+
# other features, which all center around formatting text with colours,
|
2957
|
+
# etc.
|
2958
|
+
#
|
2959
|
+
# If you want to extend CLI::UI with your own widgets, you may want to do
|
2960
|
+
# something like this:
|
2961
|
+
#
|
2962
|
+
# require('cli/ui')
|
2963
|
+
# class MyWidget < CLI::UI::Widgets::Base
|
2964
|
+
# # ...
|
2965
|
+
# end
|
2966
|
+
# CLI::UI::Widgets.register('my-widget') { MyWidget }
|
2967
|
+
# puts(CLI::UI.fmt("{{@widget/my-widget:args}}"))
|
2968
|
+
#
|
2969
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#21
|
2970
|
+
module CLI::UI::Widgets
|
2971
|
+
class << self
|
2972
|
+
# All available widgets by name
|
2973
|
+
#
|
2974
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#55
|
2975
|
+
sig { returns(T::Array[::String]) }
|
2976
|
+
def available; end
|
2977
|
+
|
2978
|
+
# Looks up a widget by handle
|
2979
|
+
#
|
2980
|
+
# ==== Raises
|
2981
|
+
# Raises InvalidWidgetHandle if the widget is not available.
|
2982
|
+
#
|
2983
|
+
# ==== Returns
|
2984
|
+
# A callable widget, to be invoked like `.call(argstring)`
|
2985
|
+
#
|
2986
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#46
|
2987
|
+
sig { params(handle: ::String).returns(T.class_of(CLI::UI::Widgets::Base)) }
|
2988
|
+
def lookup(handle); end
|
2989
|
+
|
2990
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#33
|
2991
|
+
sig { params(name: ::String, cb: T.proc.returns(T.class_of(CLI::UI::Widgets::Base))).void }
|
2992
|
+
def register(name, &cb); end
|
2993
|
+
end
|
2994
|
+
end
|
2995
|
+
|
2996
|
+
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2997
|
+
#
|
2998
|
+
# source://cli-ui//lib/cli/ui/widgets/base.rb#9
|
2999
|
+
class CLI::UI::Widgets::Base
|
3000
|
+
abstract!
|
3001
|
+
|
3002
|
+
# source://cli-ui//lib/cli/ui/widgets/base.rb#24
|
3003
|
+
sig { params(argstring: ::String).void }
|
3004
|
+
def initialize(argstring); end
|
3005
|
+
|
3006
|
+
# @abstract
|
3007
|
+
#
|
3008
|
+
# source://cli-ui//lib/cli/ui/widgets/base.rb#43
|
3009
|
+
sig { abstract.returns(::String) }
|
3010
|
+
def render; end
|
3011
|
+
|
3012
|
+
class << self
|
3013
|
+
# @abstract
|
3014
|
+
#
|
3015
|
+
# source://cli-ui//lib/cli/ui/widgets/base.rb#39
|
3016
|
+
sig { abstract.returns(::Regexp) }
|
3017
|
+
def argparse_pattern; end
|
3018
|
+
|
3019
|
+
# source://cli-ui//lib/cli/ui/widgets/base.rb#18
|
3020
|
+
sig { params(argstring: ::String).returns(::String) }
|
3021
|
+
def call(argstring); end
|
3022
|
+
end
|
3023
|
+
end
|
3024
|
+
|
3025
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#79
|
3026
|
+
class CLI::UI::Widgets::InvalidWidgetArguments < ::ArgumentError
|
3027
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#83
|
3028
|
+
sig { params(argstring: ::String, pattern: ::Regexp).void }
|
3029
|
+
def initialize(argstring, pattern); end
|
3030
|
+
|
3031
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#90
|
3032
|
+
sig { returns(::String) }
|
3033
|
+
def message; end
|
3034
|
+
end
|
3035
|
+
|
3036
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#62
|
3037
|
+
class CLI::UI::Widgets::InvalidWidgetHandle < ::ArgumentError
|
3038
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#66
|
3039
|
+
sig { params(handle: ::String).void }
|
3040
|
+
def initialize(handle); end
|
3041
|
+
|
3042
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#72
|
3043
|
+
sig { returns(::String) }
|
3044
|
+
def message; end
|
3045
|
+
end
|
3046
|
+
|
3047
|
+
# source://cli-ui//lib/cli/ui/widgets.rb#24
|
3048
|
+
CLI::UI::Widgets::MAP = T.let(T.unsafe(nil), Hash)
|
3049
|
+
|
3050
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#9
|
3051
|
+
class CLI::UI::Widgets::Status < ::CLI::UI::Widgets::Base
|
3052
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#34
|
3053
|
+
sig { override.returns(::String) }
|
3054
|
+
def render; end
|
3055
|
+
|
3056
|
+
private
|
3057
|
+
|
3058
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#51
|
3059
|
+
sig { params(num_str: ::String, rune: ::String, color: ::CLI::UI::Color).returns(::String) }
|
3060
|
+
def colorize_if_nonzero(num_str, rune, color); end
|
3061
|
+
|
3062
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#62
|
3063
|
+
sig { returns(::String) }
|
3064
|
+
def failed_part; end
|
3065
|
+
|
3066
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#73
|
3067
|
+
sig { returns(::String) }
|
3068
|
+
def pending_part; end
|
3069
|
+
|
3070
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#57
|
3071
|
+
sig { returns(::String) }
|
3072
|
+
def succeeded_part; end
|
3073
|
+
|
3074
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#67
|
3075
|
+
sig { returns(::String) }
|
3076
|
+
def working_part; end
|
3077
|
+
|
3078
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#46
|
3079
|
+
sig { params(num_str: ::String).returns(T::Boolean) }
|
3080
|
+
def zero?(num_str); end
|
3081
|
+
|
3082
|
+
class << self
|
3083
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#28
|
3084
|
+
sig { override.returns(::Regexp) }
|
3085
|
+
def argparse_pattern; end
|
3086
|
+
end
|
3087
|
+
end
|
3088
|
+
|
3089
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#10
|
3090
|
+
CLI::UI::Widgets::Status::ARGPARSE_PATTERN = T.let(T.unsafe(nil), Regexp)
|
3091
|
+
|
3092
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#18
|
3093
|
+
CLI::UI::Widgets::Status::ARROW = T.let(T.unsafe(nil), String)
|
3094
|
+
|
3095
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#17
|
3096
|
+
CLI::UI::Widgets::Status::CLOSE = T.let(T.unsafe(nil), String)
|
3097
|
+
|
3098
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#19
|
3099
|
+
CLI::UI::Widgets::Status::COMMA = T.let(T.unsafe(nil), String)
|
3100
|
+
|
3101
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#22
|
3102
|
+
CLI::UI::Widgets::Status::EMPTY_SET = T.let(T.unsafe(nil), String)
|
3103
|
+
|
3104
|
+
# e.g. "1:23:3:404"
|
3105
|
+
#
|
3106
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#16
|
3107
|
+
CLI::UI::Widgets::Status::OPEN = T.let(T.unsafe(nil), String)
|
3108
|
+
|
3109
|
+
# source://cli-ui//lib/cli/ui/widgets/status.rb#21
|
3110
|
+
CLI::UI::Widgets::Status::SPINNER_STOPPED = T.let(T.unsafe(nil), String)
|
3111
|
+
|
3112
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#6
|
3113
|
+
class CLI::UI::WorkQueue
|
3114
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#72
|
3115
|
+
sig { params(max_concurrent: ::Integer).void }
|
3116
|
+
def initialize(max_concurrent); end
|
3117
|
+
|
3118
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#91
|
3119
|
+
sig { void }
|
3120
|
+
def close; end
|
3121
|
+
|
3122
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#81
|
3123
|
+
sig { params(block: T.proc.returns(T.untyped)).returns(::CLI::UI::WorkQueue::Future) }
|
3124
|
+
def enqueue(&block); end
|
3125
|
+
|
3126
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#102
|
3127
|
+
sig { void }
|
3128
|
+
def interrupt; end
|
3129
|
+
|
3130
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#96
|
3131
|
+
sig { void }
|
3132
|
+
def wait; end
|
3133
|
+
|
3134
|
+
private
|
3135
|
+
|
3136
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#120
|
3137
|
+
sig { void }
|
3138
|
+
def start_worker; end
|
3139
|
+
end
|
3140
|
+
|
3141
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#9
|
3142
|
+
class CLI::UI::WorkQueue::Future
|
3143
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#13
|
3144
|
+
sig { void }
|
3145
|
+
def initialize; end
|
3146
|
+
|
3147
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#23
|
3148
|
+
sig { params(result: T.untyped).void }
|
3149
|
+
def complete(result); end
|
3150
|
+
|
3151
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#53
|
3152
|
+
sig { returns(T::Boolean) }
|
3153
|
+
def completed?; end
|
3154
|
+
|
3155
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#32
|
3156
|
+
sig { params(error: ::Exception).void }
|
3157
|
+
def fail(error); end
|
3158
|
+
|
3159
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#63
|
3160
|
+
sig { void }
|
3161
|
+
def start; end
|
3162
|
+
|
3163
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#58
|
3164
|
+
sig { returns(T::Boolean) }
|
3165
|
+
def started?; end
|
3166
|
+
|
3167
|
+
# source://cli-ui//lib/cli/ui/work_queue.rb#43
|
3168
|
+
sig { returns(T.untyped) }
|
3169
|
+
def value; end
|
3170
|
+
end
|
3171
|
+
|
3172
|
+
# source://cli-ui//lib/cli/ui/wrap.rb#11
|
3173
|
+
class CLI::UI::Wrap
|
3174
|
+
# source://cli-ui//lib/cli/ui/wrap.rb#15
|
3175
|
+
sig { params(input: ::String).void }
|
3176
|
+
def initialize(input); end
|
3177
|
+
|
3178
|
+
# source://cli-ui//lib/cli/ui/wrap.rb#20
|
3179
|
+
sig { params(total_width: ::Integer).returns(::String) }
|
3180
|
+
def wrap(total_width = T.unsafe(nil)); end
|
3181
|
+
end
|