danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,1132 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `claide` gem.
5
+ # Please instead update this file by running `bin/tapioca gem claide`.
6
+
7
+ # The mods of interest are {CLAide::ARGV}, {CLAide::Command}, and
8
+ # {CLAide::InformativeError}
9
+ module CLAide; end
10
+
11
+ # Provides support for ANSI Escape sequences
12
+ #
13
+ # For more information see:
14
+ #
15
+ # - http://ascii-table.com/ansi-escape-sequences.php
16
+ # - http://en.wikipedia.org/wiki/ANSI_escape_code
17
+ #
18
+ # This functionality has been inspired and derived from the following gems:
19
+ #
20
+ # - colored
21
+ # - colorize
22
+ class CLAide::ANSI
23
+ extend ::CLAide::ANSI::Cursor
24
+ extend ::CLAide::ANSI::Graphics
25
+
26
+ class << self
27
+ # @param key [Symbol] The key for which the code is needed.
28
+ # @param map [Hash{Symbol => Fixnum}] A hash which associates each code to each key.
29
+ # @raise If the key is not provided.
30
+ # @raise If the key is not present in the map.
31
+ # @return [Fixnum] The code of a key given the map.
32
+ def code_for_key(key, map); end
33
+
34
+ # original string. This method is intended to offer a central location
35
+ # where to disable ANSI logic without needed to implement conditionals
36
+ # across the code base of clients.
37
+ #
38
+ # @example
39
+ #
40
+ # "example".ansi.yellow #=> "\e[33mexample\e[39m"
41
+ # ANSI.disabled = true
42
+ # "example".ansi.yellow #=> "example"
43
+ # @return [Bool] Wether the string mixin should be disabled to return the
44
+ def disabled; end
45
+
46
+ # original string. This method is intended to offer a central location
47
+ # where to disable ANSI logic without needed to implement conditionals
48
+ # across the code base of clients.
49
+ #
50
+ # @example
51
+ #
52
+ # "example".ansi.yellow #=> "\e[33mexample\e[39m"
53
+ # ANSI.disabled = true
54
+ # "example".ansi.yellow #=> "example"
55
+ # @return [Bool] Wether the string mixin should be disabled to return the
56
+ def disabled=(_arg0); end
57
+ end
58
+ end
59
+
60
+ # @return [Hash{Symbol => Fixnum}] The colors codes by their English name.
61
+ CLAide::ANSI::COLORS = T.let(T.unsafe(nil), Hash)
62
+
63
+ # Provides support for generating escape sequences relative to the position
64
+ # of the cursor and to erase parts of text.
65
+ module CLAide::ANSI::Cursor
66
+ class << self
67
+ # @return [String] The escape sequence to erase the display.
68
+ def erase_display; end
69
+
70
+ # @return [String] The escape sequence to erase a line form the
71
+ # cursor position to then end.
72
+ def erase_line; end
73
+
74
+ # @param lines [Fixnum] The amount of lines the cursor should be moved to.
75
+ # Negative values indicate up direction and positive ones
76
+ # down direction.
77
+ # @param columns [Fixnum] The amount of columns the cursor should be moved to.
78
+ # Negative values indicate left direction and positive ones
79
+ # right direction.
80
+ # @return [String] The escape sequence to set the cursor at the
81
+ # given line.
82
+ def move_cursor(lines, columns = T.unsafe(nil)); end
83
+
84
+ # @return [String] The escape sequence to restore the cursor to the
85
+ # previously saved position. This sequence also clears all the
86
+ # output after the position.
87
+ def restore_cursor_position; end
88
+
89
+ # @return [String] The escape sequence to save the cursor position.
90
+ def save_cursor_position; end
91
+
92
+ # @param line [Fixnum] The line where to place the cursor.
93
+ # @param column [Fixnum] The column where to place the cursor.
94
+ # @return [String] The escape sequence to set the cursor at the
95
+ # given line.
96
+ def set_cursor_position(line = T.unsafe(nil), column = T.unsafe(nil)); end
97
+ end
98
+ end
99
+
100
+ # Return [String] The escape sequence for the default background color.
101
+ CLAide::ANSI::DEFAULT_BACKGROUND_COLOR = T.let(T.unsafe(nil), String)
102
+
103
+ # Return [String] The escape sequence for the default foreground color.
104
+ CLAide::ANSI::DEFAULT_FOREGROUND_COLOR = T.let(T.unsafe(nil), String)
105
+
106
+ # Provides support for generating escape sequences relative to the graphic
107
+ # mode.
108
+ module CLAide::ANSI::Graphics
109
+ class << self
110
+ # @param key [Symbol] The name of the color.
111
+ # @return [String] The escape sequence for a background color.
112
+ def background_color(key); end
113
+
114
+ # @param color [Fixnum] The value of the color.
115
+ # @return [String] The escape sequence for a background color using the
116
+ # xterm-256 format.
117
+ def background_color_256(color); end
118
+
119
+ # @param key [Symbol] The name of the color.
120
+ # @return [String] The escape sequence for a foreground color.
121
+ def foreground_color(key); end
122
+
123
+ # @param color [Fixnum] The value of the color.
124
+ # @return [String] The escape sequence for a foreground color using the
125
+ # xterm-256 format.
126
+ def foreground_color_256(color); end
127
+
128
+ # @param codes [Fixnum, Array<Fixnum>] The code(s).
129
+ # @return [String] The escape sequence for a single or a list of codes.
130
+ def graphics_mode(codes); end
131
+
132
+ # @param key [Symbol] The name of the text attribute.
133
+ # @return [String] The escape sequence for a text attribute.
134
+ def text_attribute(key); end
135
+ end
136
+ end
137
+
138
+ # Return [String] The escape sequence to reset the graphics.
139
+ CLAide::ANSI::RESET_SEQUENCE = T.let(T.unsafe(nil), String)
140
+
141
+ # Provides support to wrap strings in ANSI sequences according to the
142
+ # `ANSI.disabled` setting.
143
+ class CLAide::ANSI::StringEscaper < ::String
144
+ # @param string [String] The string to wrap.
145
+ # @return [StringEscaper] a new instance of StringEscaper
146
+ def initialize(string); end
147
+
148
+ # @param keys [Array<Symbol>] One or more keys corresponding to ANSI codes to apply to the
149
+ # string.
150
+ # @return [StringEscaper]
151
+ def apply(*keys); end
152
+
153
+ def black; end
154
+ def blink; end
155
+ def blue; end
156
+ def bold; end
157
+ def cyan; end
158
+ def green; end
159
+ def hidden; end
160
+ def magenta; end
161
+ def on_black; end
162
+ def on_blue; end
163
+ def on_cyan; end
164
+ def on_green; end
165
+ def on_magenta; end
166
+ def on_red; end
167
+ def on_white; end
168
+ def on_yellow; end
169
+ def red; end
170
+ def reverse; end
171
+ def underline; end
172
+ def white; end
173
+
174
+ # @return [StringEscaper] Wraps a string in the given ANSI sequences,
175
+ # taking care of handling existing sequences for the same
176
+ # family of attributes (i.e. attributes terminated by the
177
+ # same sequence).
178
+ def wrap_in_ansi_sequence(open, close); end
179
+
180
+ def yellow; end
181
+ end
182
+
183
+ # @return [Hash{Symbol => Fixnum}] The text attributes codes by their
184
+ # English name.
185
+ CLAide::ANSI::TEXT_ATTRIBUTES = T.let(T.unsafe(nil), Hash)
186
+
187
+ # @return [Hash{Symbol => Fixnum}] The codes to disable a text attribute by
188
+ # their name.
189
+ CLAide::ANSI::TEXT_DISABLE_ATTRIBUTES = T.let(T.unsafe(nil), Hash)
190
+
191
+ # This class is responsible for parsing the parameters specified by the user,
192
+ # accessing individual parameters, and keep state by removing handled
193
+ # parameters.
194
+ class CLAide::ARGV
195
+ # @param argv [Array<#to_s>] A list of parameters.
196
+ # @return [ARGV] a new instance of ARGV
197
+ def initialize(argv); end
198
+
199
+ # @example
200
+ #
201
+ # argv = CLAide::ARGV.new(['--ignore=foo', '--ignore=bar'])
202
+ # argv.all_options('include') # => []
203
+ # argv.all_options('ignore') # => ['bar', 'foo']
204
+ # argv.remainder # => []
205
+ # @note This will remove the option from the remaining parameters.
206
+ # @param name [String] The name of the option to look for among the remaining
207
+ # parameters.
208
+ # @return [Array<String>] Returns an array of all the values of the option
209
+ # with the specified `name` among the remaining
210
+ # parameters.
211
+ def all_options(name); end
212
+
213
+ # @example
214
+ #
215
+ # argv = CLAide::ARGV.new(['tea', 'white', '--no-milk', 'biscuit'])
216
+ # argv.shift_argument # => 'tea'
217
+ # argv.arguments # => ['white', 'biscuit']
218
+ # @return [Array<String>] A list of the remaining arguments.
219
+ def arguments; end
220
+
221
+ # @example
222
+ #
223
+ # argv = CLAide::ARGV.new(['tea', 'white', '--no-milk', 'biscuit'])
224
+ # argv.arguments # => ['tea', 'white', 'biscuit']
225
+ # argv.arguments! # => ['tea', 'white', 'biscuit']
226
+ # argv.arguments # => []
227
+ # @note This version also removes the arguments from the remaining
228
+ # parameters.
229
+ # @return [Array<String>] A list of the remaining arguments.
230
+ def arguments!; end
231
+
232
+ # @return [Boolean] Whether or not there are any remaining unhandled
233
+ # parameters.
234
+ def empty?; end
235
+
236
+ # @example
237
+ #
238
+ # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey'])
239
+ # argv.flag?('milk') # => false
240
+ # argv.flag?('milk') # => nil
241
+ # argv.flag?('milk', true) # => true
242
+ # argv.remainder # => ['tea', '--sweetener=honey']
243
+ # @note This will remove the flag from the remaining parameters.
244
+ # @param name [String] The name of the flag to look for among the remaining parameters.
245
+ # @param default [Boolean] The value that is returned in case the flag is not among the
246
+ # remaining parameters.
247
+ # @return [Boolean, nil] Returns `true` if the flag by the specified `name`
248
+ # is among the remaining parameters and is not negated.
249
+ def flag?(name, default = T.unsafe(nil)); end
250
+
251
+ # @example
252
+ #
253
+ # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey'])
254
+ # argv.option('sweetener') # => 'honey'
255
+ # argv.option('sweetener') # => nil
256
+ # argv.option('sweetener', 'sugar') # => 'sugar'
257
+ # argv.remainder # => ['tea', '--no-milk']
258
+ # @note This will remove the option from the remaining parameters.
259
+ # @param name [String] The name of the option to look for among the remaining
260
+ # parameters.
261
+ # @param default [String] The value that is returned in case the option is not among the
262
+ # remaining parameters.
263
+ # @return [String, nil] Returns the value of the option by the specified
264
+ # `name` is among the remaining parameters.
265
+ def option(name, default = T.unsafe(nil)); end
266
+
267
+ # @example
268
+ #
269
+ # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey'])
270
+ # argv.options # => { 'milk' => false, 'sweetener' => 'honey' }
271
+ # @return [Hash] A hash that consists of the remaining flags and options
272
+ # and their values.
273
+ def options; end
274
+
275
+ # @example
276
+ #
277
+ # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey'])
278
+ # argv.shift_argument # => 'tea'
279
+ # argv.remainder # => ['--no-milk', '--sweetener=honey']
280
+ # @return [Array<String>] A list of the remaining unhandled parameters, in
281
+ # the same format a user specifies it in.
282
+ def remainder; end
283
+
284
+ # @example
285
+ #
286
+ # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey'])
287
+ # argv.shift_argument # => 'tea'
288
+ # argv.remainder! # => ['--no-milk', '--sweetener=honey']
289
+ # argv.remainder # => []
290
+ # @return [Array<String>] A list of the remaining unhandled parameters, in
291
+ # the same format the user specified them.
292
+ def remainder!; end
293
+
294
+ # @example
295
+ #
296
+ # argv = CLAide::ARGV.new(['tea', 'white'])
297
+ # argv.shift_argument # => 'tea'
298
+ # argv.arguments # => ['white']
299
+ # @note This will remove the argument from the remaining parameters.
300
+ # @return [String] The first argument in the remaining parameters.
301
+ def shift_argument; end
302
+
303
+ private
304
+
305
+ # @param requested_type [Symbol] The type of the entry.
306
+ # @param requested_key [String] The key of the entry.
307
+ # @param default [Bool, String, Nil] The value which should be returned if the entry is not present.
308
+ # @param delete_all [Bool] Whether all values matching `requested_type` and `requested_key`
309
+ # should be deleted.
310
+ # @return [Bool, String, Nil] Removes an entry from the entries list and
311
+ # returns its value or the default value if the entry was not
312
+ # present.
313
+ def delete_entry(requested_type, requested_key, default, delete_all = T.unsafe(nil)); end
314
+
315
+ # @return [Array<Array<Symbol, String, Array>>] A list of tuples for each
316
+ # non consumed parameter, where the first entry is the `type` and
317
+ # the second entry the actual parsed parameter.
318
+ def entries; end
319
+
320
+ class << self
321
+ # @param argv [Object] The object which should be converted to the ARGV class.
322
+ # @return [ARGV] Coerces an object to the ARGV class if needed.
323
+ def coerce(argv); end
324
+ end
325
+ end
326
+
327
+ module CLAide::ARGV::Parser
328
+ class << self
329
+ # @param argument [String] The argument to check.
330
+ # @return [Symbol] Returns the type of an argument. The types can be
331
+ # either: `:arg`, `:flag`, `:option`.
332
+ def argument_type(argument); end
333
+
334
+ # @example
335
+ #
336
+ # list = parse(['tea', '--no-milk', '--sweetener=honey'])
337
+ # list # => [[:arg, "tea"],
338
+ # [:flag, ["milk", false]],
339
+ # [:option, ["sweetener", "honey"]]]
340
+ # @return [Array<Array<Symbol, String, Array>>] A list of tuples for each
341
+ # parameter, where the first entry is the `type` and the second
342
+ # entry the actual parsed parameter.
343
+ def parse(argv); end
344
+
345
+ # @param type [Symbol] The type of the argument.
346
+ # @param argument [String] The argument to check.
347
+ # @return [String, Array<String, String>] Returns the argument itself for
348
+ # normal arguments (like commands) and a tuple with the key and
349
+ # the value for options and flags.
350
+ def parse_argument(type, argument); end
351
+
352
+ # @param argument [String] The flag argument to check.
353
+ # @return [String, Array<String, String>] Returns the parameter
354
+ # describing a flag arguments.
355
+ def parse_flag(argument); end
356
+ end
357
+ end
358
+
359
+ # This class is used to represent individual arguments to present to
360
+ # the command help banner
361
+ class CLAide::Argument
362
+ # @example
363
+ #
364
+ # # A required parameter that can be either a NAME or URL
365
+ # Argument.new(%(NAME URL), true)
366
+ # @param names [String, Array<String>] List of the names of each parameter alternatives.
367
+ # For convenience, if there is only one alternative for that
368
+ # parameter, we can use a String instead of a 1-item Array
369
+ # @param required [Boolean] true if the parameter is required, false if it is optional
370
+ # @param repeatable [Boolean] If true, the argument can appear multiple times in the command.
371
+ # In that case, an ellipsis will be appended after the argument
372
+ # in the help banner.
373
+ # @return [Argument] a new instance of Argument
374
+ def initialize(names, required, repeatable = T.unsafe(nil)); end
375
+
376
+ # @param other [Argument] the Argument compared against
377
+ # @return [Boolean] true on equality
378
+ def ==(other); end
379
+
380
+ # @return [Array<String>] List of alternate names for the parameters
381
+ def names; end
382
+
383
+ # @return [Boolean] Indicates if the argument is repeatable (= can appear multiple
384
+ # times in the command, which is indicated by '...' in the banner)
385
+ def repeatable; end
386
+
387
+ # @return [Boolean] Indicates if the argument is repeatable (= can appear multiple
388
+ # times in the command, which is indicated by '...' in the banner)
389
+ def repeatable=(_arg0); end
390
+
391
+ # @return [Boolean] Indicates if the argument is repeatable (= can appear multiple
392
+ # times in the command, which is indicated by '...' in the banner)
393
+ def repeatable?; end
394
+
395
+ # @return [Boolean] Indicates if the argument is required (not optional)
396
+ def required; end
397
+
398
+ # @return [Boolean] Indicates if the argument is required (not optional)
399
+ def required=(_arg0); end
400
+
401
+ # @return [Boolean] Indicates if the argument is required (not optional)
402
+ def required?; end
403
+ end
404
+
405
+ # The string used for ellipsis / repeatable arguments in the banner
406
+ CLAide::Argument::ELLIPSIS = T.let(T.unsafe(nil), String)
407
+
408
+ # This class is used to build a command-line interface
409
+ #
410
+ # Each command is represented by a subclass of this class, which may be
411
+ # nested to create more granular commands.
412
+ #
413
+ # Following is an overview of the types of commands and what they should do.
414
+ #
415
+ # ### Any command type
416
+ #
417
+ # * Inherit from the command class under which the command should be nested.
418
+ # * Set {Command.summary} to a brief description of the command.
419
+ # * Override {Command.options} to return the options it handles and their
420
+ # descriptions and prepending them to the results of calling `super`.
421
+ # * Override {Command#initialize} if it handles any parameters.
422
+ # * Override {Command#validate!} to check if the required parameters the
423
+ # command handles are valid, or call {Command#help!} in case they’re not.
424
+ #
425
+ # ### Abstract command
426
+ #
427
+ # The following is needed for an abstract command:
428
+ #
429
+ # * Set {Command.abstract_command} to `true`.
430
+ # * Subclass the command.
431
+ #
432
+ # When the optional {Command.description} is specified, it will be shown at
433
+ # the top of the command’s help banner.
434
+ #
435
+ # ### Normal command
436
+ #
437
+ # The following is needed for a normal command:
438
+ #
439
+ # * Set {Command.arguments} to the description of the arguments this command
440
+ # handles.
441
+ # * Override {Command#run} to perform the actual work.
442
+ #
443
+ # When the optional {Command.description} is specified, it will be shown
444
+ # underneath the usage section of the command’s help banner. Otherwise this
445
+ # defaults to {Command.summary}.
446
+ class CLAide::Command
447
+ # Subclasses should override this method to remove the arguments/options
448
+ # they support from `argv` _before_ calling `super`.
449
+ #
450
+ # The `super` implementation sets the {#verbose} attribute based on whether
451
+ # or not the `--verbose` option is specified; and the {#ansi_output}
452
+ # attribute to `false` if {Command.ansi_output} returns `true`, but the
453
+ # user specified the `--no-ansi` option.
454
+ #
455
+ # @param argv [ARGV, Array] A list of (user-supplied) params that should be handled.
456
+ # @return [Command] a new instance of Command
457
+ def initialize(argv); end
458
+
459
+ # Set to `true` if {Command.ansi_output} returns `true` and the user
460
+ # did **not** specify the `--no-ansi` option.
461
+ #
462
+ # @note If you want to make use of this value for your own configuration, you
463
+ # should check the value _after_ calling the `super` {Command#initialize}
464
+ # implementation.
465
+ # @return [Boolean] Whether or not to use ANSI codes to prettify output. For instance, by
466
+ # default {InformativeError} exception messages will be colored red and
467
+ # subcommands in help banners green.
468
+ def ansi_output; end
469
+
470
+ # Set to `true` if {Command.ansi_output} returns `true` and the user
471
+ # did **not** specify the `--no-ansi` option.
472
+ #
473
+ # @note If you want to make use of this value for your own configuration, you
474
+ # should check the value _after_ calling the `super` {Command#initialize}
475
+ # implementation.
476
+ # @return [Boolean] Whether or not to use ANSI codes to prettify output. For instance, by
477
+ # default {InformativeError} exception messages will be colored red and
478
+ # subcommands in help banners green.
479
+ def ansi_output=(_arg0); end
480
+
481
+ # Set to `true` if {Command.ansi_output} returns `true` and the user
482
+ # did **not** specify the `--no-ansi` option.
483
+ #
484
+ # @note If you want to make use of this value for your own configuration, you
485
+ # should check the value _after_ calling the `super` {Command#initialize}
486
+ # implementation.
487
+ # @return [Boolean] Whether or not to use ANSI codes to prettify output. For instance, by
488
+ # default {InformativeError} exception messages will be colored red and
489
+ # subcommands in help banners green.
490
+ def ansi_output?; end
491
+
492
+ # Handles root commands options if appropriate.
493
+ #
494
+ # @param argv [ARGV] The parameters of the command.
495
+ # @return [Bool] Whether any root command option was handled.
496
+ def handle_root_options(argv); end
497
+
498
+ # Set to `true` if initialized with a `--help` flag
499
+ #
500
+ # @return [Boolean] Whether the command was initialized with argv containing --help
501
+ def help?; end
502
+
503
+ # Set to `true` if initialized with a `--help` flag
504
+ #
505
+ # @return [Boolean] Whether the command was initialized with argv containing --help
506
+ def help_arg; end
507
+
508
+ # Set to `true` if initialized with a `--help` flag
509
+ #
510
+ # @return [Boolean] Whether the command was initialized with argv containing --help
511
+ def help_arg=(_arg0); end
512
+
513
+ # @return [Bool] Whether the command was invoked by an abstract command by
514
+ # default.
515
+ def invoked_as_default; end
516
+
517
+ # @return [Bool] Whether the command was invoked by an abstract command by
518
+ # default.
519
+ def invoked_as_default=(_arg0); end
520
+
521
+ # @return [Bool] Whether the command was invoked by an abstract command by
522
+ # default.
523
+ def invoked_as_default?; end
524
+
525
+ # Prints the version of the command optionally including plugins.
526
+ def print_version; end
527
+
528
+ # This method should be overridden by the command class to perform its
529
+ # work.
530
+ #
531
+ # @return [void]
532
+ def run; end
533
+
534
+ # Raises a Help exception if the `--help` option is specified, if `argv`
535
+ # still contains remaining arguments/options by the time it reaches this
536
+ # implementation, or when called on an ‘abstract command’.
537
+ #
538
+ # Subclasses should call `super` _before_ doing their own validation. This
539
+ # way when the user specifies the `--help` flag a help banner is shown,
540
+ # instead of possible actual validation errors.
541
+ #
542
+ # @raise [Help]
543
+ # @return [void]
544
+ def validate!; end
545
+
546
+ # Set to `true` if the user specifies the `--verbose` option.
547
+ #
548
+ # @note If you want to make use of this value for your own configuration, you
549
+ # should check the value _after_ calling the `super` {Command#initialize}
550
+ # implementation.
551
+ # @return [Boolean] Wether or not backtraces should be included when presenting the user an
552
+ # exception that includes the {InformativeError} module.
553
+ def verbose; end
554
+
555
+ # Set to `true` if the user specifies the `--verbose` option.
556
+ #
557
+ # @note If you want to make use of this value for your own configuration, you
558
+ # should check the value _after_ calling the `super` {Command#initialize}
559
+ # implementation.
560
+ # @return [Boolean] Wether or not backtraces should be included when presenting the user an
561
+ # exception that includes the {InformativeError} module.
562
+ def verbose=(_arg0); end
563
+
564
+ # Set to `true` if the user specifies the `--verbose` option.
565
+ #
566
+ # @note If you want to make use of this value for your own configuration, you
567
+ # should check the value _after_ calling the `super` {Command#initialize}
568
+ # implementation.
569
+ # @return [Boolean] Wether or not backtraces should be included when presenting the user an
570
+ # exception that includes the {InformativeError} module.
571
+ def verbose?; end
572
+
573
+ protected
574
+
575
+ # Print banner and exit
576
+ #
577
+ # @note Calling this method exits the current process.
578
+ # @return [void]
579
+ def banner!; end
580
+
581
+ # @param error_message [String] A custom optional error message
582
+ # @raise [Help] Signals CLAide that a help banner for this command should be shown,
583
+ # with an optional error message.
584
+ # @return [void]
585
+ def help!(error_message = T.unsafe(nil)); end
586
+
587
+ # Returns the class of the invoked command
588
+ #
589
+ # @return [Command]
590
+ def invoked_command_class; end
591
+
592
+ class << self
593
+ # @return [Boolean] Indicates whether or not this command can actually
594
+ # perform work of itself, or that it only contains subcommands.
595
+ def abstract_command; end
596
+
597
+ # @return [Boolean] Indicates whether or not this command can actually
598
+ # perform work of itself, or that it only contains subcommands.
599
+ def abstract_command=(_arg0); end
600
+
601
+ # @return [Boolean] Indicates whether or not this command can actually
602
+ # perform work of itself, or that it only contains subcommands.
603
+ def abstract_command?; end
604
+
605
+ # @return [Boolean] The default value for {Command#ansi_output}. This
606
+ # defaults to `true` if `STDOUT` is connected to a TTY and
607
+ # `String` has the instance methods `#red`, `#green`, and
608
+ # `#yellow` (which are defined by, for instance, the
609
+ # [colored](https://github.com/defunkt/colored) gem).
610
+ def ansi_output; end
611
+
612
+ # Sets the attribute ansi_output
613
+ #
614
+ # @param value the value to set the attribute ansi_output to.
615
+ def ansi_output=(_arg0); end
616
+
617
+ # @return [Boolean] The default value for {Command#ansi_output}. This
618
+ # defaults to `true` if `STDOUT` is connected to a TTY and
619
+ # `String` has the instance methods `#red`, `#green`, and
620
+ # `#yellow` (which are defined by, for instance, the
621
+ # [colored](https://github.com/defunkt/colored) gem).
622
+ def ansi_output?; end
623
+
624
+ # @return [Array<Argument>] A list of arguments the command handles. This is shown
625
+ # in the usage section of the command’s help banner.
626
+ # Each Argument in the array represents an argument by its name
627
+ # (or list of alternatives) and whether it's required or optional
628
+ def arguments; end
629
+
630
+ # @param arguments [Array<Argument>] An array listing the command arguments.
631
+ # Each Argument object describe the argument by its name
632
+ # (or list of alternatives) and whether it's required or optional
633
+ # @todo Remove deprecation
634
+ def arguments=(arguments); end
635
+
636
+ # Handle deprecated form of self.arguments as an
637
+ # Array<Array<(String, Symbol)>> like in:
638
+ #
639
+ # self.arguments = [ ['NAME', :required], ['QUERY', :optional] ]
640
+ #
641
+ # @todo Remove deprecated format support
642
+ def arguments_array=(arguments); end
643
+
644
+ # Handle deprecated form of self.arguments as a String, like in:
645
+ #
646
+ # self.arguments = 'NAME [QUERY]'
647
+ #
648
+ # @todo Remove deprecated format support
649
+ def arguments_string=(arguments); end
650
+
651
+ # Returns the banner for the command.
652
+ #
653
+ # @param banner_class [Class] The class to use to format help banners.
654
+ # @return [String] The banner for the command.
655
+ def banner(banner_class = T.unsafe(nil)); end
656
+
657
+ # Print banner and exit
658
+ #
659
+ # @note Calling this method exits the current process.
660
+ # @return [void]
661
+ def banner!; end
662
+
663
+ # @return [String] The name of the command. Defaults to a snake-cased
664
+ # version of the class’ name.
665
+ def command; end
666
+
667
+ # Sets the attribute command
668
+ #
669
+ # @param value the value to set the attribute command to.
670
+ def command=(_arg0); end
671
+
672
+ # @return [String] The subcommand which an abstract command should invoke
673
+ # by default.
674
+ def default_subcommand; end
675
+
676
+ # @return [String] The subcommand which an abstract command should invoke
677
+ # by default.
678
+ def default_subcommand=(_arg0); end
679
+
680
+ # @return [String] A longer description of the command, which is shown
681
+ # underneath the usage section of the command’s help banner. Any
682
+ # indentation in this value will be ignored.
683
+ def description; end
684
+
685
+ # @return [String] A longer description of the command, which is shown
686
+ # underneath the usage section of the command’s help banner. Any
687
+ # indentation in this value will be ignored.
688
+ def description=(_arg0); end
689
+
690
+ # Searches the list of subcommands that should not be ignored for command
691
+ # lookup for a subcommand with the given `name`.
692
+ #
693
+ # @param name [String] The name of the subcommand to be found.
694
+ # @return [CLAide::Command, nil] The subcommand, if found.
695
+ def find_subcommand(name); end
696
+
697
+ # @example
698
+ #
699
+ # BevarageMaker::Tea.full_command # => "beverage-maker tea"
700
+ # @return [String] The full command up-to this command, as it would be
701
+ # looked up during parsing.
702
+ def full_command; end
703
+
704
+ # Presents an exception to the user in a short manner in case of an
705
+ # `InformativeError` or in long form in other cases,
706
+ #
707
+ # @param command [Command, nil] The command from where the exception originated.
708
+ # @param exception [Object] The exception to present.
709
+ # @return [void]
710
+ def handle_exception(command, exception); end
711
+
712
+ # @param error_message [String] The error message to show to the user.
713
+ # @param help_class [Class] The class to use to raise a ‘help’ error.
714
+ # @raise [Help] Signals CLAide that a help banner for this command should be shown,
715
+ # with an optional error message.
716
+ # @return [void]
717
+ def help!(error_message = T.unsafe(nil), help_class = T.unsafe(nil)); end
718
+
719
+ # @return [Boolean] Indicates whether or not this command is used during
720
+ # command parsing and whether or not it should be shown in the
721
+ # help banner or to show its subcommands instead.
722
+ #
723
+ # Setting this to `true` implies it’s an abstract command.
724
+ def ignore_in_command_lookup; end
725
+
726
+ def ignore_in_command_lookup=(flag); end
727
+
728
+ # @return [Boolean] Indicates whether or not this command is used during
729
+ # command parsing and whether or not it should be shown in the
730
+ # help banner or to show its subcommands instead.
731
+ #
732
+ # Setting this to `true` implies it’s an abstract command.
733
+ def ignore_in_command_lookup?; end
734
+
735
+ # Automatically registers a subclass as a subcommand.
736
+ def inherited(subcommand); end
737
+
738
+ # Convenience method.
739
+ # Instantiate the command and run it with the provided arguments at once.
740
+ #
741
+ # CLAide::Command::run, it does not load plugins nor exit on failure.
742
+ # It is up to the caller to rescue any possible exception raised.
743
+ #
744
+ # @note This method validate! the command before running it, but contrary to
745
+ # @param args [String..., Array<String>] The arguments to initialize the command with
746
+ # @raise [Help] If validate! fails
747
+ def invoke(*args); end
748
+
749
+ # @param argv [Array, ARGV] A list of (remaining) parameters.
750
+ # @return [Command] Returns the default subcommand initialized with the
751
+ # given arguments.
752
+ def load_default_subcommand(argv); end
753
+
754
+ # Should be overridden by a subclass if it handles any options.
755
+ #
756
+ # The subclass has to combine the result of calling `super` and its own
757
+ # list of options. The recommended way of doing this is by concatenating
758
+ # to this classes’ own options.
759
+ #
760
+ # @example
761
+ #
762
+ # def self.options
763
+ # [
764
+ # ['--verbose', 'Print more info'],
765
+ # ['--help', 'Print help banner'],
766
+ # ].concat(super)
767
+ # end
768
+ # @return [Array<Array>] A list of option name and description tuples.
769
+ def options; end
770
+
771
+ # @param argv [Array, ARGV] A list of (remaining) parameters.
772
+ # @return [Command] An instance of the command class that was matched by
773
+ # going through the arguments in the parameters and drilling down
774
+ # command classes.
775
+ def parse(argv); end
776
+
777
+ # Handle depracted form of assigning a plugin prefix.
778
+ #
779
+ # @todo Remove deprecated form.
780
+ def plugin_prefix=(prefix); end
781
+
782
+ # @return [Array<String>] The prefixes used to search for CLAide plugins.
783
+ # Plugins are loaded via their `<plugin_prefix>_plugin.rb` file.
784
+ # Defaults to search for `claide` plugins.
785
+ def plugin_prefixes; end
786
+
787
+ # Sets the attribute plugin_prefixes
788
+ #
789
+ # @param value the value to set the attribute plugin_prefixes to.
790
+ def plugin_prefixes=(_arg0); end
791
+
792
+ # Allows the application to perform custom error reporting, by overriding
793
+ # this method.
794
+ #
795
+ # @param exception [Exception] An exception that occurred while running a command through
796
+ # {Command.run}.
797
+ # @raise By default re-raises the specified exception.
798
+ # @return [void]
799
+ def report_error(exception); end
800
+
801
+ # @return [Bool] Whether this is the root command class
802
+ def root_command?; end
803
+
804
+ # Instantiates the command class matching the parameters through
805
+ # {Command.parse}, validates it through {Command#validate!}, and runs it
806
+ # through {Command#run}.
807
+ #
808
+ # @note The ANSI support is configured before running a command to allow
809
+ # the same process to run multiple commands with different
810
+ # settings. For example a process with ANSI output enabled might
811
+ # want to programmatically invoke another command with the output
812
+ # enabled.
813
+ # @param argv [Array, ARGV] A list of parameters. For instance, the standard `ARGV` constant,
814
+ # which contains the parameters passed to the program.
815
+ # @return [void]
816
+ def run(argv = T.unsafe(nil)); end
817
+
818
+ # @return [Array<Class>] A list of all command classes that are nested
819
+ # under this command.
820
+ def subcommands; end
821
+
822
+ # @return [Array<Class>] A list of command classes that are nested under
823
+ # this command _or_ the subcommands of those command classes in
824
+ # case the command class should be ignored in command lookup.
825
+ def subcommands_for_command_lookup; end
826
+
827
+ # @return [String] A brief description of the command, which is shown
828
+ # next to the command in the help banner of a parent command.
829
+ def summary; end
830
+
831
+ # @return [String] A brief description of the command, which is shown
832
+ # next to the command in the help banner of a parent command.
833
+ def summary=(_arg0); end
834
+
835
+ # @return [String] The version of the command. This value will be printed
836
+ # by the `--version` flag if used for the root command.
837
+ def version; end
838
+
839
+ # @return [String] The version of the command. This value will be printed
840
+ # by the `--version` flag if used for the root command.
841
+ def version=(_arg0); end
842
+
843
+ private
844
+
845
+ # Adds a new option for the current command.
846
+ #
847
+ # This method can be used in conjunction with overriding `options`.
848
+ #
849
+ # @example
850
+ #
851
+ # option '--help', 'Print help banner '
852
+ # @return [void]
853
+ def option(name, description); end
854
+ end
855
+ end
856
+
857
+ class CLAide::Command::ArgumentSuggester
858
+ # @param argument [String] The unrecognized argument for which to make a suggestion.
859
+ # @param command_class [Class] The class of the command which encountered the unrecognized
860
+ # arguments.
861
+ # @return [ArgumentSuggester] a new instance of ArgumentSuggester
862
+ def initialize(argument, command_class); end
863
+
864
+ # @return [Array<String>] The list of the valid arguments for a command
865
+ # according to the type of the argument.
866
+ def possibilities; end
867
+
868
+ # @return [String] Returns a suggested argument from `possibilities` based
869
+ # on the `levenshtein_distance` score.
870
+ def suggested_argument; end
871
+
872
+ # @return [String] Returns a message including a suggestion for the given
873
+ # suggestion.
874
+ def suggestion; end
875
+
876
+ class << self
877
+ # Returns the Levenshtein distance between the given strings.
878
+ # From: http://rosettacode.org/wiki/Levenshtein_distance#Ruby
879
+ #
880
+ # @param a [String] The first string to compare.
881
+ # @param b [String] The second string to compare.
882
+ # @return [Fixnum] The distance between the strings.
883
+ def levenshtein_distance(a, b); end
884
+
885
+ # Prettifies the given validation suggestion according to the type.
886
+ #
887
+ # @param suggestion [String] The suggestion to prettify.
888
+ # @param argument_type [Type] The type of the suggestion: either `:command` or `:option`.
889
+ # @return [String] A handsome suggestion.
890
+ def prettify_suggestion(suggestion, argument_type); end
891
+ end
892
+ end
893
+
894
+ # Creates the formatted banner to present as help of the provided command
895
+ # class.
896
+ class CLAide::Command::Banner
897
+ # @param command [Class] @see command
898
+ # @return [Banner] a new instance of Banner
899
+ def initialize(command); end
900
+
901
+ # @return [Class] The command for which the banner should be created.
902
+ def command; end
903
+
904
+ # @return [Class] The command for which the banner should be created.
905
+ def command=(_arg0); end
906
+
907
+ # @return [String] The banner for the command.
908
+ def formatted_banner; end
909
+
910
+ private
911
+
912
+ # @return [Fixnum] The width of the largest command name or of the
913
+ # largest option name. Used to align all the descriptions.
914
+ def compute_max_name_width; end
915
+
916
+ # @return [String] The line describing a single entry (subcommand or
917
+ # option).
918
+ def entry_description(name, description, name_width); end
919
+
920
+ # @return [String] The section describing the options of the command.
921
+ def formatted_options_description; end
922
+
923
+ # @note The plus sign emphasizes the that the subcommands are added to
924
+ # the command. The square brackets conveys a sense of direction
925
+ # and indicates the gravitational force towards the default
926
+ # command.
927
+ # @return [String] The section describing the subcommands of the command.
928
+ def formatted_subcommand_summaries; end
929
+
930
+ # @return [String] The section describing the usage of the command.
931
+ def formatted_usage_description; end
932
+
933
+ # @return [String] A decorated command description.
934
+ def prettify_message(command, message); end
935
+
936
+ # @return [String] A decorated textual representation of the option name.
937
+ def prettify_option_name(name); end
938
+
939
+ # @return [String] A decorated textual representation of the command.
940
+ def prettify_signature(command, subcommand, argument); end
941
+
942
+ # @return [String] A decorated textual representation of the subcommand
943
+ # name.
944
+ def prettify_subcommand(name); end
945
+
946
+ # @return [String] A decorated title.
947
+ def prettify_title(title); end
948
+
949
+ # @return [String] The signature of the command.
950
+ def signature; end
951
+
952
+ # @return [String] The arguments of the signature.
953
+ def signature_arguments; end
954
+
955
+ # @return [String] The subcommand indicator of the signature.
956
+ def signature_sub_command; end
957
+
958
+ # @return [Array<String>] The list of the subcommands to use in the
959
+ # banner.
960
+ def subcommands_for_banner; end
961
+ end
962
+
963
+ # @return [Fixnum] The minimum between a name and its description.
964
+ CLAide::Command::Banner::DESCRIPTION_SPACES = T.let(T.unsafe(nil), Integer)
965
+
966
+ # @return [Fixnum] The maximum width of the text.
967
+ CLAide::Command::Banner::MAX_WIDTH = T.let(T.unsafe(nil), Integer)
968
+
969
+ # @return [Fixnum] The minimum between a name and its description.
970
+ CLAide::Command::Banner::SUBCOMMAND_BULLET_SIZE = T.let(T.unsafe(nil), Integer)
971
+
972
+ # @return [String] The indentation of the text.
973
+ CLAide::Command::Banner::TEXT_INDENT = T.let(T.unsafe(nil), Integer)
974
+
975
+ module CLAide::Command::Banner::TextWrapper
976
+ class << self
977
+ # @return [String] Lifted straight from ActiveSupport. Thanks guys!
978
+ def strip_heredoc(string); end
979
+
980
+ # @return [Fixnum] The width of the current terminal unless being piped.
981
+ def terminal_width; end
982
+
983
+ # @return [String] Lifted straight from ActionView. Thanks guys!
984
+ def word_wrap(line, line_width); end
985
+
986
+ # @param string [String] The string to format.
987
+ # @param indent [Fixnum] The number of spaces to insert before the string.
988
+ # @param max_width [Fixnum] The maximum width to use to format the string if the terminal
989
+ # is too wide.
990
+ # @return [String] Wraps a formatted string (e.g. markdown) by stripping
991
+ # heredoc indentation and wrapping by word to the terminal width
992
+ # taking into account a maximum one, and indenting the string.
993
+ # Code lines (i.e. indented by four spaces) are not wrapped.
994
+ def wrap_formatted_text(string, indent = T.unsafe(nil), max_width = T.unsafe(nil)); end
995
+
996
+ # @param string [String] The string to indent.
997
+ # @param indent [Fixnum] The number of spaces to insert before the string.
998
+ # @param max_width [Fixnum] The maximum width to use to format the string if the terminal
999
+ # is too wide.
1000
+ # @return [String] Wraps a string to the terminal width taking into
1001
+ # account the given indentation.
1002
+ def wrap_with_indent(string, indent = T.unsafe(nil), max_width = T.unsafe(nil)); end
1003
+
1004
+ private
1005
+
1006
+ def calculate_terminal_width; end
1007
+ end
1008
+ end
1009
+
1010
+ CLAide::Command::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Array)
1011
+ CLAide::Command::DEFAULT_ROOT_OPTIONS = T.let(T.unsafe(nil), Array)
1012
+
1013
+ # Handles plugin related logic logic for the `Command` class.
1014
+ #
1015
+ # Plugins are loaded the first time a command run and are identified by the
1016
+ # prefix specified in the command class. Plugins must adopt the following
1017
+ # conventions:
1018
+ #
1019
+ # - Support being loaded by a file located under the
1020
+ # `lib/#{plugin_prefix}_plugin` relative path.
1021
+ # - Be stored in a folder named after the plugin.
1022
+ class CLAide::Command::PluginManager
1023
+ class << self
1024
+ # @return [Array<Specification>] The RubyGems specifications for the
1025
+ # installed plugins that match the given `plugin_prefix`.
1026
+ def installed_specifications_for_prefix(plugin_prefix); end
1027
+
1028
+ # @return [Array<Gem::Specification>] Loads plugins via RubyGems looking
1029
+ # for files named after the `PLUGIN_PREFIX_plugin` and returns the
1030
+ # specifications of the gems loaded successfully.
1031
+ # Plugins are required safely.
1032
+ def load_plugins(plugin_prefix); end
1033
+
1034
+ # @return [Hash<String,Gem::Specification>] The loaded plugins,
1035
+ # grouped by plugin prefix.
1036
+ def loaded_plugins; end
1037
+
1038
+ # @return [Array<[Gem::Specification, Array<String>]>] Returns an array of tuples containing the specifications and
1039
+ # plugin files to require for a given plugin prefix.
1040
+ def plugin_gems_for_prefix(prefix); end
1041
+
1042
+ # @param exception [Exception] The exception to analyze.
1043
+ # @return [Array<String>] The list of the plugins whose root path appears
1044
+ # in the backtrace of an exception.
1045
+ def plugins_involved_in_exception(exception); end
1046
+
1047
+ # Requires the given paths.
1048
+ # If any exception occurs it is caught and an
1049
+ # informative message is printed.
1050
+ #
1051
+ # @param paths [String] The paths to require.
1052
+ # @return [Bool] Whether requiring succeeded.
1053
+ def safe_require(paths); end
1054
+
1055
+ # @return [Array<Specification>] The RubyGems specifications for the
1056
+ # loaded plugins.
1057
+ def specifications; end
1058
+
1059
+ private
1060
+
1061
+ def full_require_paths_for(gemspec); end
1062
+ end
1063
+ end
1064
+
1065
+ # The exception class that is raised to indicate a help banner should be
1066
+ # shown while running {Command.run}.
1067
+ class CLAide::Help < ::StandardError
1068
+ include ::CLAide::InformativeError
1069
+
1070
+ # @note If an error message is provided, the exit status, used to
1071
+ # terminate the program with, will be set to `1`, otherwise a {Help}
1072
+ # exception is treated as not being a real error and exits with `0`.
1073
+ # @param banner [String] @see banner
1074
+ # @param error_message [String] @see error_message
1075
+ # @return [Help] a new instance of Help
1076
+ def initialize(banner, error_message = T.unsafe(nil)); end
1077
+
1078
+ # command to show in the help.
1079
+ #
1080
+ # @return [String] The banner containing the usage instructions of the
1081
+ def banner; end
1082
+
1083
+ # @return [String] An optional error message that will be shown before the
1084
+ # help banner.
1085
+ def error_message; end
1086
+
1087
+ # @return [String] The optional error message, colored in red if
1088
+ # {Command.ansi_output} is set to `true`.
1089
+ def formatted_error_message; end
1090
+
1091
+ # @return [String] The optional error message, combined with the help
1092
+ # banner of the command.
1093
+ def message; end
1094
+
1095
+ # @return [String]
1096
+ def prettify_error_message(message); end
1097
+ end
1098
+
1099
+ # Including this module into an exception class will ensure that when raised,
1100
+ # while running {Command.run}, only the message of the exception will be
1101
+ # shown to the user. Unless disabled with the `--verbose` flag.
1102
+ #
1103
+ # In addition, the message will be colored red, if {Command.ansi_output}
1104
+ # is set to `true`.
1105
+ module CLAide::InformativeError
1106
+ def exit_status; end
1107
+
1108
+ # @return [Numeric] The exist status code that should be used to terminate
1109
+ # the program with. Defaults to `1`.
1110
+ def exit_status=(_arg0); end
1111
+ end
1112
+
1113
+ # Enhance the String class with a XML escaped character version of
1114
+ # to_s.
1115
+ class String
1116
+ include ::Comparable
1117
+ include ::JSON::Ext::Generator::GeneratorMethods::String
1118
+ include ::Colored2
1119
+ extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
1120
+
1121
+ # @example
1122
+ #
1123
+ # "example".ansi.yellow #=> "\e[33mexample\e[39m"
1124
+ # "example".ansi.on_red #=> "\e[41mexample\e[49m"
1125
+ # "example".ansi.bold #=> "\e[1mexample\e[21m"
1126
+ # @return [StringEscaper] An object which provides convenience methods to
1127
+ # wrap the receiver in ANSI sequences.
1128
+ def ansi; end
1129
+ end
1130
+
1131
+ String::BLANK_RE = T.let(T.unsafe(nil), Regexp)
1132
+ String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map)