ruby_json_parser 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +35 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +143 -0
- data/Rakefile +12 -0
- data/lib/ruby_json_parser/ast.rb +312 -0
- data/lib/ruby_json_parser/evaluator.rb +81 -0
- data/lib/ruby_json_parser/lexer.rb +358 -0
- data/lib/ruby_json_parser/parser.rb +205 -0
- data/lib/ruby_json_parser/result.rb +43 -0
- data/lib/ruby_json_parser/token.rb +171 -0
- data/lib/ruby_json_parser/version.rb +6 -0
- data/lib/ruby_json_parser.rb +77 -0
- data/sorbet/config +4 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
- data/sorbet/rbi/gems/erubi@1.13.0.rbi +150 -0
- data/sorbet/rbi/gems/json@2.7.2.rbi +1562 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14238 -0
- data/sorbet/rbi/gems/minitest@5.24.1.rbi +1563 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/parallel@1.25.1.rbi +287 -0
- data/sorbet/rbi/gems/parser@3.3.4.0.rbi +5519 -0
- data/sorbet/rbi/gems/prism@0.30.0.rbi +39212 -0
- data/sorbet/rbi/gems/racc@1.8.0.rbi +162 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
- data/sorbet/rbi/gems/rake@13.2.1.rbi +3028 -0
- data/sorbet/rbi/gems/rbi@0.1.13.rbi +3078 -0
- data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +3772 -0
- data/sorbet/rbi/gems/rexml@3.3.1.rbi +4813 -0
- data/sorbet/rbi/gems/rubocop-ast@1.31.3.rbi +7015 -0
- data/sorbet/rbi/gems/rubocop@1.65.0.rbi +58191 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
- data/sorbet/rbi/gems/spoom@1.3.3.rbi +4926 -0
- data/sorbet/rbi/gems/strscan@3.1.0.rbi +9 -0
- data/sorbet/rbi/gems/tapioca@0.15.1.rbi +3566 -0
- data/sorbet/rbi/gems/thor@1.3.1.rbi +4352 -0
- data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +66 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.36.rbi +18221 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +4 -0
- metadata +105 -0
@@ -0,0 +1,4352 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `thor` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem thor`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://thor//lib/thor/shell/lcs_diff.rb#1
|
9
|
+
module LCSDiff
|
10
|
+
protected
|
11
|
+
|
12
|
+
# Overwrite show_diff to show diff with colors if Diff::LCS is
|
13
|
+
# available.
|
14
|
+
#
|
15
|
+
# source://thor//lib/thor/shell/lcs_diff.rb#6
|
16
|
+
def show_diff(destination, content); end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Check if Diff::LCS is loaded. If it is, use it to create pretty output
|
21
|
+
# for diff.
|
22
|
+
#
|
23
|
+
# @return [Boolean]
|
24
|
+
#
|
25
|
+
# source://thor//lib/thor/shell/lcs_diff.rb#37
|
26
|
+
def diff_lcs_loaded?; end
|
27
|
+
|
28
|
+
# source://thor//lib/thor/shell/lcs_diff.rb#21
|
29
|
+
def output_diff_line(diff); end
|
30
|
+
end
|
31
|
+
|
32
|
+
# source://thor//lib/thor/command.rb#1
|
33
|
+
class Thor
|
34
|
+
include ::Thor::Base
|
35
|
+
include ::Thor::Invocation
|
36
|
+
include ::Thor::Shell
|
37
|
+
extend ::Thor::Base::ClassMethods
|
38
|
+
extend ::Thor::Invocation::ClassMethods
|
39
|
+
|
40
|
+
# source://thor//lib/thor.rb#652
|
41
|
+
def help(command = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
42
|
+
|
43
|
+
class << self
|
44
|
+
# Adds and declares option group for required at least one of options in the
|
45
|
+
# block of arguments. You can declare options as the outside of the block.
|
46
|
+
#
|
47
|
+
# If :for is given as option, it allows you to change the options from
|
48
|
+
# a previous defined command.
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
# Array[Thor::Option.name]
|
52
|
+
# options<Hash>:: :for is applied for previous defined command.
|
53
|
+
#
|
54
|
+
# ==== Examples
|
55
|
+
#
|
56
|
+
# at_least_one do
|
57
|
+
# option :one
|
58
|
+
# option :two
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# Or
|
62
|
+
#
|
63
|
+
# option :one
|
64
|
+
# option :two
|
65
|
+
# at_least_one :one, :two
|
66
|
+
#
|
67
|
+
# If you do not give "--one" and "--two" AtLeastOneRequiredArgumentError
|
68
|
+
# will be raised.
|
69
|
+
#
|
70
|
+
# You can use at_least_one and exclusive at the same time.
|
71
|
+
#
|
72
|
+
# exclusive do
|
73
|
+
# at_least_one do
|
74
|
+
# option :one
|
75
|
+
# option :two
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# Then it is required either only one of "--one" or "--two".
|
80
|
+
#
|
81
|
+
# source://thor//lib/thor.rb#246
|
82
|
+
def at_least_one(*args, &block); end
|
83
|
+
|
84
|
+
# Extend check unknown options to accept a hash of conditions.
|
85
|
+
#
|
86
|
+
# === Parameters
|
87
|
+
# options<Hash>: A hash containing :only and/or :except keys
|
88
|
+
#
|
89
|
+
# source://thor//lib/thor.rb#350
|
90
|
+
def check_unknown_options!(options = T.unsafe(nil)); end
|
91
|
+
|
92
|
+
# Overwrite check_unknown_options? to take subcommands and options into account.
|
93
|
+
#
|
94
|
+
# @return [Boolean]
|
95
|
+
#
|
96
|
+
# source://thor//lib/thor.rb#363
|
97
|
+
def check_unknown_options?(config); end
|
98
|
+
|
99
|
+
# Prints help information for the given command.
|
100
|
+
#
|
101
|
+
# ==== Parameters
|
102
|
+
# shell<Thor::Shell>
|
103
|
+
# command_name<String>
|
104
|
+
#
|
105
|
+
# source://thor//lib/thor.rb#258
|
106
|
+
def command_help(shell, command_name); end
|
107
|
+
|
108
|
+
# Sets the default command when thor is executed without an explicit command to be called.
|
109
|
+
#
|
110
|
+
# ==== Parameters
|
111
|
+
# meth<Symbol>:: name of the default command
|
112
|
+
#
|
113
|
+
# source://thor//lib/thor.rb#21
|
114
|
+
def default_command(meth = T.unsafe(nil)); end
|
115
|
+
|
116
|
+
# Sets the default command when thor is executed without an explicit command to be called.
|
117
|
+
#
|
118
|
+
# ==== Parameters
|
119
|
+
# meth<Symbol>:: name of the default command
|
120
|
+
#
|
121
|
+
# source://thor//lib/thor.rb#21
|
122
|
+
def default_task(meth = T.unsafe(nil)); end
|
123
|
+
|
124
|
+
# source://thor//lib/thor/base.rb#26
|
125
|
+
def deprecation_warning(message); end
|
126
|
+
|
127
|
+
# Defines the usage and the description of the next command.
|
128
|
+
#
|
129
|
+
# ==== Parameters
|
130
|
+
# usage<String>
|
131
|
+
# description<String>
|
132
|
+
# options<String>
|
133
|
+
#
|
134
|
+
# source://thor//lib/thor.rb#54
|
135
|
+
def desc(usage, description, options = T.unsafe(nil)); end
|
136
|
+
|
137
|
+
# Disable the check for required options for the given commands.
|
138
|
+
# This is useful if you have a command that does not need the required options
|
139
|
+
# to work, like help.
|
140
|
+
#
|
141
|
+
# ==== Parameters
|
142
|
+
# Symbol ...:: A list of commands that should be affected.
|
143
|
+
#
|
144
|
+
# source://thor//lib/thor.rb#434
|
145
|
+
def disable_required_check!(*command_names); end
|
146
|
+
|
147
|
+
# @return [Boolean]
|
148
|
+
#
|
149
|
+
# source://thor//lib/thor.rb#438
|
150
|
+
def disable_required_check?(command); end
|
151
|
+
|
152
|
+
# Adds and declares option group for exclusive options in the
|
153
|
+
# block and arguments. You can declare options as the outside of the block.
|
154
|
+
#
|
155
|
+
# If :for is given as option, it allows you to change the options from
|
156
|
+
# a previous defined command.
|
157
|
+
#
|
158
|
+
# ==== Parameters
|
159
|
+
# Array[Thor::Option.name]
|
160
|
+
# options<Hash>:: :for is applied for previous defined command.
|
161
|
+
#
|
162
|
+
# ==== Examples
|
163
|
+
#
|
164
|
+
# exclusive do
|
165
|
+
# option :one
|
166
|
+
# option :two
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# Or
|
170
|
+
#
|
171
|
+
# option :one
|
172
|
+
# option :two
|
173
|
+
# exclusive :one, :two
|
174
|
+
#
|
175
|
+
# If you give "--one" and "--two" at the same time ExclusiveArgumentsError
|
176
|
+
# will be raised.
|
177
|
+
#
|
178
|
+
# source://thor//lib/thor.rb#203
|
179
|
+
def exclusive(*args, &block); end
|
180
|
+
|
181
|
+
# Prints help information for this class.
|
182
|
+
#
|
183
|
+
# ==== Parameters
|
184
|
+
# shell<Thor::Shell>
|
185
|
+
#
|
186
|
+
# source://thor//lib/thor.rb#288
|
187
|
+
def help(shell, subcommand = T.unsafe(nil)); end
|
188
|
+
|
189
|
+
# Defines the long description of the next command.
|
190
|
+
#
|
191
|
+
# Long description is by default indented, line-wrapped and repeated whitespace merged.
|
192
|
+
# In order to print long description verbatim, with indentation and spacing exactly
|
193
|
+
# as found in the code, use the +wrap+ option
|
194
|
+
#
|
195
|
+
# long_desc 'your very long description', wrap: false
|
196
|
+
#
|
197
|
+
# ==== Parameters
|
198
|
+
# long description<String>
|
199
|
+
# options<Hash>
|
200
|
+
#
|
201
|
+
# source://thor//lib/thor.rb#78
|
202
|
+
def long_desc(long_description, options = T.unsafe(nil)); end
|
203
|
+
|
204
|
+
# Maps an input to a command. If you define:
|
205
|
+
#
|
206
|
+
# map "-T" => "list"
|
207
|
+
#
|
208
|
+
# Running:
|
209
|
+
#
|
210
|
+
# thor -T
|
211
|
+
#
|
212
|
+
# Will invoke the list command.
|
213
|
+
#
|
214
|
+
# ==== Parameters
|
215
|
+
# Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command.
|
216
|
+
#
|
217
|
+
# source://thor//lib/thor.rb#101
|
218
|
+
def map(mappings = T.unsafe(nil), **kw); end
|
219
|
+
|
220
|
+
# Adds and declares option group for required at least one of options in the
|
221
|
+
# block of arguments. You can declare options as the outside of the block.
|
222
|
+
#
|
223
|
+
# If :for is given as option, it allows you to change the options from
|
224
|
+
# a previous defined command.
|
225
|
+
#
|
226
|
+
# ==== Parameters
|
227
|
+
# Array[Thor::Option.name]
|
228
|
+
# options<Hash>:: :for is applied for previous defined command.
|
229
|
+
#
|
230
|
+
# ==== Examples
|
231
|
+
#
|
232
|
+
# at_least_one do
|
233
|
+
# option :one
|
234
|
+
# option :two
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# Or
|
238
|
+
#
|
239
|
+
# option :one
|
240
|
+
# option :two
|
241
|
+
# at_least_one :one, :two
|
242
|
+
#
|
243
|
+
# If you do not give "--one" and "--two" AtLeastOneRequiredArgumentError
|
244
|
+
# will be raised.
|
245
|
+
#
|
246
|
+
# You can use at_least_one and exclusive at the same time.
|
247
|
+
#
|
248
|
+
# exclusive do
|
249
|
+
# at_least_one do
|
250
|
+
# option :one
|
251
|
+
# option :two
|
252
|
+
# end
|
253
|
+
# end
|
254
|
+
#
|
255
|
+
# Then it is required either only one of "--one" or "--two".
|
256
|
+
#
|
257
|
+
# source://thor//lib/thor.rb#246
|
258
|
+
def method_at_least_one(*args, &block); end
|
259
|
+
|
260
|
+
# Adds and declares option group for exclusive options in the
|
261
|
+
# block and arguments. You can declare options as the outside of the block.
|
262
|
+
#
|
263
|
+
# If :for is given as option, it allows you to change the options from
|
264
|
+
# a previous defined command.
|
265
|
+
#
|
266
|
+
# ==== Parameters
|
267
|
+
# Array[Thor::Option.name]
|
268
|
+
# options<Hash>:: :for is applied for previous defined command.
|
269
|
+
#
|
270
|
+
# ==== Examples
|
271
|
+
#
|
272
|
+
# exclusive do
|
273
|
+
# option :one
|
274
|
+
# option :two
|
275
|
+
# end
|
276
|
+
#
|
277
|
+
# Or
|
278
|
+
#
|
279
|
+
# option :one
|
280
|
+
# option :two
|
281
|
+
# exclusive :one, :two
|
282
|
+
#
|
283
|
+
# If you give "--one" and "--two" at the same time ExclusiveArgumentsError
|
284
|
+
# will be raised.
|
285
|
+
#
|
286
|
+
# source://thor//lib/thor.rb#203
|
287
|
+
def method_exclusive(*args, &block); end
|
288
|
+
|
289
|
+
# Adds an option to the set of method options. If :for is given as option,
|
290
|
+
# it allows you to change the options from a previous defined command.
|
291
|
+
#
|
292
|
+
# def previous_command
|
293
|
+
# # magic
|
294
|
+
# end
|
295
|
+
#
|
296
|
+
# method_option :foo, :for => :previous_command
|
297
|
+
#
|
298
|
+
# def next_command
|
299
|
+
# # magic
|
300
|
+
# end
|
301
|
+
#
|
302
|
+
# ==== Parameters
|
303
|
+
# name<Symbol>:: The name of the argument.
|
304
|
+
# options<Hash>:: Described below.
|
305
|
+
#
|
306
|
+
# ==== Options
|
307
|
+
# :desc - Description for the argument.
|
308
|
+
# :required - If the argument is required or not.
|
309
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
310
|
+
# :aliases - Aliases for this option.
|
311
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
312
|
+
# :banner - String to show on usage notes.
|
313
|
+
# :hide - If you want to hide this option from the help.
|
314
|
+
#
|
315
|
+
# source://thor//lib/thor.rb#163
|
316
|
+
def method_option(name, options = T.unsafe(nil)); end
|
317
|
+
|
318
|
+
# Declares the options for the next command to be declared.
|
319
|
+
#
|
320
|
+
# ==== Parameters
|
321
|
+
# Hash[Symbol => Object]:: The hash key is the name of the option and the value
|
322
|
+
# is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
|
323
|
+
# or :required (string). If you give a value, the type of the value is used.
|
324
|
+
#
|
325
|
+
# source://thor//lib/thor.rb#129
|
326
|
+
def method_options(options = T.unsafe(nil)); end
|
327
|
+
|
328
|
+
# Adds an option to the set of method options. If :for is given as option,
|
329
|
+
# it allows you to change the options from a previous defined command.
|
330
|
+
#
|
331
|
+
# def previous_command
|
332
|
+
# # magic
|
333
|
+
# end
|
334
|
+
#
|
335
|
+
# method_option :foo, :for => :previous_command
|
336
|
+
#
|
337
|
+
# def next_command
|
338
|
+
# # magic
|
339
|
+
# end
|
340
|
+
#
|
341
|
+
# ==== Parameters
|
342
|
+
# name<Symbol>:: The name of the argument.
|
343
|
+
# options<Hash>:: Described below.
|
344
|
+
#
|
345
|
+
# ==== Options
|
346
|
+
# :desc - Description for the argument.
|
347
|
+
# :required - If the argument is required or not.
|
348
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
349
|
+
# :aliases - Aliases for this option.
|
350
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
351
|
+
# :banner - String to show on usage notes.
|
352
|
+
# :hide - If you want to hide this option from the help.
|
353
|
+
#
|
354
|
+
# source://thor//lib/thor.rb#163
|
355
|
+
def option(name, options = T.unsafe(nil)); end
|
356
|
+
|
357
|
+
# Declares the options for the next command to be declared.
|
358
|
+
#
|
359
|
+
# ==== Parameters
|
360
|
+
# Hash[Symbol => Object]:: The hash key is the name of the option and the value
|
361
|
+
# is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
|
362
|
+
# or :required (string). If you give a value, the type of the value is used.
|
363
|
+
#
|
364
|
+
# source://thor//lib/thor.rb#129
|
365
|
+
def options(options = T.unsafe(nil)); end
|
366
|
+
|
367
|
+
# Allows for custom "Command" package naming.
|
368
|
+
#
|
369
|
+
# === Parameters
|
370
|
+
# name<String>
|
371
|
+
# options<Hash>
|
372
|
+
#
|
373
|
+
# source://thor//lib/thor.rb#12
|
374
|
+
def package_name(name, _ = T.unsafe(nil)); end
|
375
|
+
|
376
|
+
# Returns commands ready to be printed.
|
377
|
+
#
|
378
|
+
# source://thor//lib/thor.rb#309
|
379
|
+
def printable_commands(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
380
|
+
|
381
|
+
# Returns commands ready to be printed.
|
382
|
+
#
|
383
|
+
# source://thor//lib/thor.rb#309
|
384
|
+
def printable_tasks(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
385
|
+
|
386
|
+
# Registers another Thor subclass as a command.
|
387
|
+
#
|
388
|
+
# ==== Parameters
|
389
|
+
# klass<Class>:: Thor subclass to register
|
390
|
+
# command<String>:: Subcommand name to use
|
391
|
+
# usage<String>:: Short usage for the subcommand
|
392
|
+
# description<String>:: Description for the subcommand
|
393
|
+
#
|
394
|
+
# source://thor//lib/thor.rb#37
|
395
|
+
def register(klass, subcommand_name, usage, description, options = T.unsafe(nil)); end
|
396
|
+
|
397
|
+
# Stop parsing of options as soon as an unknown option or a regular
|
398
|
+
# argument is encountered. All remaining arguments are passed to the command.
|
399
|
+
# This is useful if you have a command that can receive arbitrary additional
|
400
|
+
# options, and where those additional options should not be handled by
|
401
|
+
# Thor.
|
402
|
+
#
|
403
|
+
# ==== Example
|
404
|
+
#
|
405
|
+
# To better understand how this is useful, let's consider a command that calls
|
406
|
+
# an external command. A user may want to pass arbitrary options and
|
407
|
+
# arguments to that command. The command itself also accepts some options,
|
408
|
+
# which should be handled by Thor.
|
409
|
+
#
|
410
|
+
# class_option "verbose", :type => :boolean
|
411
|
+
# stop_on_unknown_option! :exec
|
412
|
+
# check_unknown_options! :except => :exec
|
413
|
+
#
|
414
|
+
# desc "exec", "Run a shell command"
|
415
|
+
# def exec(*args)
|
416
|
+
# puts "diagnostic output" if options[:verbose]
|
417
|
+
# Kernel.exec(*args)
|
418
|
+
# end
|
419
|
+
#
|
420
|
+
# Here +exec+ can be called with +--verbose+ to get diagnostic output,
|
421
|
+
# e.g.:
|
422
|
+
#
|
423
|
+
# $ thor exec --verbose echo foo
|
424
|
+
# diagnostic output
|
425
|
+
# foo
|
426
|
+
#
|
427
|
+
# But if +--verbose+ is given after +echo+, it is passed to +echo+ instead:
|
428
|
+
#
|
429
|
+
# $ thor exec echo --verbose foo
|
430
|
+
# --verbose foo
|
431
|
+
#
|
432
|
+
# ==== Parameters
|
433
|
+
# Symbol ...:: A list of commands that should be affected.
|
434
|
+
#
|
435
|
+
# source://thor//lib/thor.rb#420
|
436
|
+
def stop_on_unknown_option!(*command_names); end
|
437
|
+
|
438
|
+
# @return [Boolean]
|
439
|
+
#
|
440
|
+
# source://thor//lib/thor.rb#424
|
441
|
+
def stop_on_unknown_option?(command); end
|
442
|
+
|
443
|
+
# source://thor//lib/thor.rb#329
|
444
|
+
def subcommand(subcommand, subcommand_class); end
|
445
|
+
|
446
|
+
# source://thor//lib/thor.rb#325
|
447
|
+
def subcommand_classes; end
|
448
|
+
|
449
|
+
# source://thor//lib/thor.rb#320
|
450
|
+
def subcommands; end
|
451
|
+
|
452
|
+
# source://thor//lib/thor.rb#329
|
453
|
+
def subtask(subcommand, subcommand_class); end
|
454
|
+
|
455
|
+
# source://thor//lib/thor.rb#320
|
456
|
+
def subtasks; end
|
457
|
+
|
458
|
+
# Prints help information for the given command.
|
459
|
+
#
|
460
|
+
# ==== Parameters
|
461
|
+
# shell<Thor::Shell>
|
462
|
+
# command_name<String>
|
463
|
+
#
|
464
|
+
# source://thor//lib/thor.rb#258
|
465
|
+
def task_help(shell, command_name); end
|
466
|
+
|
467
|
+
protected
|
468
|
+
|
469
|
+
# The banner for this class. You can customize it if you are invoking the
|
470
|
+
# thor class by another ways which is not the Thor::Runner. It receives
|
471
|
+
# the command that is going to be invoked and a boolean which indicates if
|
472
|
+
# the namespace should be displayed as arguments.
|
473
|
+
#
|
474
|
+
# source://thor//lib/thor.rb#535
|
475
|
+
def banner(command, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
476
|
+
|
477
|
+
# source://thor//lib/thor.rb#541
|
478
|
+
def baseclass; end
|
479
|
+
|
480
|
+
# source://thor//lib/thor.rb#549
|
481
|
+
def create_command(meth); end
|
482
|
+
|
483
|
+
# source://thor//lib/thor.rb#549
|
484
|
+
def create_task(meth); end
|
485
|
+
|
486
|
+
# help command has the required check disabled by default.
|
487
|
+
#
|
488
|
+
# source://thor//lib/thor.rb#467
|
489
|
+
def disable_required_check; end
|
490
|
+
|
491
|
+
# The method responsible for dispatching given the args.
|
492
|
+
#
|
493
|
+
# @yield [instance]
|
494
|
+
#
|
495
|
+
# source://thor//lib/thor.rb#494
|
496
|
+
def dispatch(meth, given_args, given_opts, config); end
|
497
|
+
|
498
|
+
# source://thor//lib/thor.rb#545
|
499
|
+
def dynamic_command_class; end
|
500
|
+
|
501
|
+
# this is the logic that takes the command name passed in by the user
|
502
|
+
# and determines whether it is an unambiguous substrings of a command or
|
503
|
+
# alias name.
|
504
|
+
#
|
505
|
+
# source://thor//lib/thor.rb#615
|
506
|
+
def find_command_possibilities(meth); end
|
507
|
+
|
508
|
+
# this is the logic that takes the command name passed in by the user
|
509
|
+
# and determines whether it is an unambiguous substrings of a command or
|
510
|
+
# alias name.
|
511
|
+
#
|
512
|
+
# source://thor//lib/thor.rb#615
|
513
|
+
def find_task_possibilities(meth); end
|
514
|
+
|
515
|
+
# source://thor//lib/thor.rb#575
|
516
|
+
def initialize_added; end
|
517
|
+
|
518
|
+
# Returns this class at least one of required options array set.
|
519
|
+
#
|
520
|
+
# ==== Returns
|
521
|
+
# Array[Array[Thor::Option.name]]
|
522
|
+
#
|
523
|
+
# source://thor//lib/thor.rb#458
|
524
|
+
def method_at_least_one_option_names; end
|
525
|
+
|
526
|
+
# Returns this class exclusive options array set.
|
527
|
+
#
|
528
|
+
# ==== Returns
|
529
|
+
# Array[Array[Thor::Option.name]]
|
530
|
+
#
|
531
|
+
# source://thor//lib/thor.rb#449
|
532
|
+
def method_exclusive_option_names; end
|
533
|
+
|
534
|
+
# receives a (possibly nil) command name and returns a name that is in
|
535
|
+
# the commands hash. In addition to normalizing aliases, this logic
|
536
|
+
# will determine if a shortened command is an unambiguous substring of
|
537
|
+
# a command or alias.
|
538
|
+
#
|
539
|
+
# +normalize_command_name+ also converts names like +animal-prison+
|
540
|
+
# into +animal_prison+.
|
541
|
+
#
|
542
|
+
# @raise [AmbiguousTaskError]
|
543
|
+
#
|
544
|
+
# source://thor//lib/thor.rb#594
|
545
|
+
def normalize_command_name(meth); end
|
546
|
+
|
547
|
+
# receives a (possibly nil) command name and returns a name that is in
|
548
|
+
# the commands hash. In addition to normalizing aliases, this logic
|
549
|
+
# will determine if a shortened command is an unambiguous substring of
|
550
|
+
# a command or alias.
|
551
|
+
#
|
552
|
+
# +normalize_command_name+ also converts names like +animal-prison+
|
553
|
+
# into +animal_prison+.
|
554
|
+
#
|
555
|
+
# @raise [AmbiguousTaskError]
|
556
|
+
#
|
557
|
+
# source://thor//lib/thor.rb#594
|
558
|
+
def normalize_task_name(meth); end
|
559
|
+
|
560
|
+
# source://thor//lib/thor.rb#482
|
561
|
+
def print_at_least_one_required_options(shell, command = T.unsafe(nil)); end
|
562
|
+
|
563
|
+
# source://thor//lib/thor.rb#471
|
564
|
+
def print_exclusive_options(shell, command = T.unsafe(nil)); end
|
565
|
+
|
566
|
+
# Retrieve the command name from given args.
|
567
|
+
#
|
568
|
+
# source://thor//lib/thor.rb#581
|
569
|
+
def retrieve_command_name(args); end
|
570
|
+
|
571
|
+
# Retrieve the command name from given args.
|
572
|
+
#
|
573
|
+
# source://thor//lib/thor.rb#581
|
574
|
+
def retrieve_task_name(args); end
|
575
|
+
|
576
|
+
# Sort the commands, lexicographically by default.
|
577
|
+
#
|
578
|
+
# Can be overridden in the subclass to change the display order of the
|
579
|
+
# commands.
|
580
|
+
#
|
581
|
+
# source://thor//lib/thor.rb#642
|
582
|
+
def sort_commands!(list); end
|
583
|
+
|
584
|
+
# source://thor//lib/thor.rb#462
|
585
|
+
def stop_on_unknown_option; end
|
586
|
+
|
587
|
+
# source://thor//lib/thor.rb#630
|
588
|
+
def subcommand_help(cmd); end
|
589
|
+
|
590
|
+
# source://thor//lib/thor.rb#630
|
591
|
+
def subtask_help(cmd); end
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
595
|
+
# source://thor//lib/thor/actions/empty_directory.rb#2
|
596
|
+
module Thor::Actions
|
597
|
+
mixes_in_class_methods ::Thor::Actions::ClassMethods
|
598
|
+
|
599
|
+
# Extends initializer to add more configuration options.
|
600
|
+
#
|
601
|
+
# ==== Configuration
|
602
|
+
# behavior<Symbol>:: The actions default behavior. Can be :invoke or :revoke.
|
603
|
+
# It also accepts :force, :skip and :pretend to set the behavior
|
604
|
+
# and the respective option.
|
605
|
+
#
|
606
|
+
# destination_root<String>:: The root directory needed for some actions.
|
607
|
+
#
|
608
|
+
# source://thor//lib/thor/actions.rb#72
|
609
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
|
610
|
+
|
611
|
+
# Wraps an action object and call it accordingly to the thor class behavior.
|
612
|
+
#
|
613
|
+
# source://thor//lib/thor/actions.rb#89
|
614
|
+
def action(instance); end
|
615
|
+
|
616
|
+
# Create a new file relative to the destination root with the given data,
|
617
|
+
# which is the return value of a block or a data string.
|
618
|
+
#
|
619
|
+
# ==== Parameters
|
620
|
+
# destination<String>:: the relative path to the destination root.
|
621
|
+
# data<String|NilClass>:: the data to append to the file.
|
622
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
623
|
+
#
|
624
|
+
# ==== Examples
|
625
|
+
#
|
626
|
+
# create_file "lib/fun_party.rb" do
|
627
|
+
# hostname = ask("What is the virtual hostname I should use?")
|
628
|
+
# "vhost.name = #{hostname}"
|
629
|
+
# end
|
630
|
+
#
|
631
|
+
# create_file "config/apache.conf", "your apache config"
|
632
|
+
#
|
633
|
+
# source://thor//lib/thor/actions/create_file.rb#22
|
634
|
+
def add_file(destination, *args, &block); end
|
635
|
+
|
636
|
+
# Create a new file relative to the destination root from the given source.
|
637
|
+
#
|
638
|
+
# ==== Parameters
|
639
|
+
# destination<String>:: the relative path to the destination root.
|
640
|
+
# source<String|NilClass>:: the relative path to the source root.
|
641
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
642
|
+
# :: give :symbolic => false for hard link.
|
643
|
+
#
|
644
|
+
# ==== Examples
|
645
|
+
#
|
646
|
+
# create_link "config/apache.conf", "/etc/apache.conf"
|
647
|
+
#
|
648
|
+
# source://thor//lib/thor/actions/create_link.rb#17
|
649
|
+
def add_link(destination, *args); end
|
650
|
+
|
651
|
+
# Append text to a file. Since it depends on insert_into_file, it's reversible.
|
652
|
+
#
|
653
|
+
# ==== Parameters
|
654
|
+
# path<String>:: path of the file to be changed
|
655
|
+
# data<String>:: the data to append to the file, can be also given as a block.
|
656
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
657
|
+
#
|
658
|
+
# ==== Example
|
659
|
+
#
|
660
|
+
# append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
661
|
+
#
|
662
|
+
# append_to_file 'config/environments/test.rb' do
|
663
|
+
# 'config.gem "rspec"'
|
664
|
+
# end
|
665
|
+
#
|
666
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#192
|
667
|
+
def append_file(path, *args, &block); end
|
668
|
+
|
669
|
+
# Append text to a file. Since it depends on insert_into_file, it's reversible.
|
670
|
+
#
|
671
|
+
# ==== Parameters
|
672
|
+
# path<String>:: path of the file to be changed
|
673
|
+
# data<String>:: the data to append to the file, can be also given as a block.
|
674
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
675
|
+
#
|
676
|
+
# ==== Example
|
677
|
+
#
|
678
|
+
# append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
679
|
+
#
|
680
|
+
# append_to_file 'config/environments/test.rb' do
|
681
|
+
# 'config.gem "rspec"'
|
682
|
+
# end
|
683
|
+
#
|
684
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#192
|
685
|
+
def append_to_file(path, *args, &block); end
|
686
|
+
|
687
|
+
# Loads an external file and execute it in the instance binding.
|
688
|
+
#
|
689
|
+
# ==== Parameters
|
690
|
+
# path<String>:: The path to the file to execute. Can be a web address or
|
691
|
+
# a relative path from the source root.
|
692
|
+
#
|
693
|
+
# ==== Examples
|
694
|
+
#
|
695
|
+
# apply "http://gist.github.com/103208"
|
696
|
+
#
|
697
|
+
# apply "recipes/jquery.rb"
|
698
|
+
#
|
699
|
+
# source://thor//lib/thor/actions.rb#216
|
700
|
+
def apply(path, config = T.unsafe(nil)); end
|
701
|
+
|
702
|
+
# Returns the value of attribute behavior.
|
703
|
+
#
|
704
|
+
# source://thor//lib/thor/actions.rb#10
|
705
|
+
def behavior; end
|
706
|
+
|
707
|
+
# Sets the attribute behavior
|
708
|
+
#
|
709
|
+
# @param value the value to set the attribute behavior to.
|
710
|
+
#
|
711
|
+
# source://thor//lib/thor/actions.rb#10
|
712
|
+
def behavior=(_arg0); end
|
713
|
+
|
714
|
+
# Changes the mode of the given file or directory.
|
715
|
+
#
|
716
|
+
# ==== Parameters
|
717
|
+
# mode<Integer>:: the file mode
|
718
|
+
# path<String>:: the name of the file to change mode
|
719
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
720
|
+
#
|
721
|
+
# ==== Example
|
722
|
+
#
|
723
|
+
# chmod "script/server", 0755
|
724
|
+
#
|
725
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#145
|
726
|
+
def chmod(path, mode, config = T.unsafe(nil)); end
|
727
|
+
|
728
|
+
# Comment all lines matching a given regex. It will leave the space
|
729
|
+
# which existed before the beginning of the line in tact and will insert
|
730
|
+
# a single space after the comment hash.
|
731
|
+
#
|
732
|
+
# ==== Parameters
|
733
|
+
# path<String>:: path of the file to be changed
|
734
|
+
# flag<Regexp|String>:: the regexp or string used to decide which lines to comment
|
735
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
736
|
+
#
|
737
|
+
# ==== Example
|
738
|
+
#
|
739
|
+
# comment_lines 'config/initializers/session_store.rb', /cookie_store/
|
740
|
+
#
|
741
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#308
|
742
|
+
def comment_lines(path, flag, *args); end
|
743
|
+
|
744
|
+
# Copies the file from the relative source to the relative destination. If
|
745
|
+
# the destination is not given it's assumed to be equal to the source.
|
746
|
+
#
|
747
|
+
# ==== Parameters
|
748
|
+
# source<String>:: the relative path to the source root.
|
749
|
+
# destination<String>:: the relative path to the destination root.
|
750
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
751
|
+
# :mode => :preserve, to preserve the file mode from the source.
|
752
|
+
#
|
753
|
+
# ==== Examples
|
754
|
+
#
|
755
|
+
# copy_file "README", "doc/README"
|
756
|
+
#
|
757
|
+
# copy_file "doc/README"
|
758
|
+
#
|
759
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#20
|
760
|
+
def copy_file(source, *args, &block); end
|
761
|
+
|
762
|
+
# Create a new file relative to the destination root with the given data,
|
763
|
+
# which is the return value of a block or a data string.
|
764
|
+
#
|
765
|
+
# ==== Parameters
|
766
|
+
# destination<String>:: the relative path to the destination root.
|
767
|
+
# data<String|NilClass>:: the data to append to the file.
|
768
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
769
|
+
#
|
770
|
+
# ==== Examples
|
771
|
+
#
|
772
|
+
# create_file "lib/fun_party.rb" do
|
773
|
+
# hostname = ask("What is the virtual hostname I should use?")
|
774
|
+
# "vhost.name = #{hostname}"
|
775
|
+
# end
|
776
|
+
#
|
777
|
+
# create_file "config/apache.conf", "your apache config"
|
778
|
+
#
|
779
|
+
# source://thor//lib/thor/actions/create_file.rb#22
|
780
|
+
def create_file(destination, *args, &block); end
|
781
|
+
|
782
|
+
# Create a new file relative to the destination root from the given source.
|
783
|
+
#
|
784
|
+
# ==== Parameters
|
785
|
+
# destination<String>:: the relative path to the destination root.
|
786
|
+
# source<String|NilClass>:: the relative path to the source root.
|
787
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
788
|
+
# :: give :symbolic => false for hard link.
|
789
|
+
#
|
790
|
+
# ==== Examples
|
791
|
+
#
|
792
|
+
# create_link "config/apache.conf", "/etc/apache.conf"
|
793
|
+
#
|
794
|
+
# source://thor//lib/thor/actions/create_link.rb#17
|
795
|
+
def create_link(destination, *args); end
|
796
|
+
|
797
|
+
# Returns the root for this thor class (also aliased as destination root).
|
798
|
+
#
|
799
|
+
# source://thor//lib/thor/actions.rb#99
|
800
|
+
def destination_root; end
|
801
|
+
|
802
|
+
# Sets the root for this thor class. Relatives path are added to the
|
803
|
+
# directory where the script was invoked and expanded.
|
804
|
+
#
|
805
|
+
# source://thor//lib/thor/actions.rb#106
|
806
|
+
def destination_root=(root); end
|
807
|
+
|
808
|
+
# Copies recursively the files from source directory to root directory.
|
809
|
+
# If any of the files finishes with .tt, it's considered to be a template
|
810
|
+
# and is placed in the destination without the extension .tt. If any
|
811
|
+
# empty directory is found, it's copied and all .empty_directory files are
|
812
|
+
# ignored. If any file name is wrapped within % signs, the text within
|
813
|
+
# the % signs will be executed as a method and replaced with the returned
|
814
|
+
# value. Let's suppose a doc directory with the following files:
|
815
|
+
#
|
816
|
+
# doc/
|
817
|
+
# components/.empty_directory
|
818
|
+
# README
|
819
|
+
# rdoc.rb.tt
|
820
|
+
# %app_name%.rb
|
821
|
+
#
|
822
|
+
# When invoked as:
|
823
|
+
#
|
824
|
+
# directory "doc"
|
825
|
+
#
|
826
|
+
# It will create a doc directory in the destination with the following
|
827
|
+
# files (assuming that the `app_name` method returns the value "blog"):
|
828
|
+
#
|
829
|
+
# doc/
|
830
|
+
# components/
|
831
|
+
# README
|
832
|
+
# rdoc.rb
|
833
|
+
# blog.rb
|
834
|
+
#
|
835
|
+
# <b>Encoded path note:</b> Since Thor internals use Object#respond_to? to check if it can
|
836
|
+
# expand %something%, this `something` should be a public method in the class calling
|
837
|
+
# #directory. If a method is private, Thor stack raises PrivateMethodEncodedError.
|
838
|
+
#
|
839
|
+
# ==== Parameters
|
840
|
+
# source<String>:: the relative path to the source root.
|
841
|
+
# destination<String>:: the relative path to the destination root.
|
842
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
843
|
+
# If :recursive => false, does not look for paths recursively.
|
844
|
+
# If :mode => :preserve, preserve the file mode from the source.
|
845
|
+
# If :exclude_pattern => /regexp/, prevents copying files that match that regexp.
|
846
|
+
#
|
847
|
+
# ==== Examples
|
848
|
+
#
|
849
|
+
# directory "doc"
|
850
|
+
# directory "doc", "docs", :recursive => false
|
851
|
+
#
|
852
|
+
# source://thor//lib/thor/actions/directory.rb#49
|
853
|
+
def directory(source, *args, &block); end
|
854
|
+
|
855
|
+
# Creates an empty directory.
|
856
|
+
#
|
857
|
+
# ==== Parameters
|
858
|
+
# destination<String>:: the relative path to the destination root.
|
859
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
860
|
+
#
|
861
|
+
# ==== Examples
|
862
|
+
#
|
863
|
+
# empty_directory "doc"
|
864
|
+
#
|
865
|
+
# source://thor//lib/thor/actions/empty_directory.rb#13
|
866
|
+
def empty_directory(destination, config = T.unsafe(nil)); end
|
867
|
+
|
868
|
+
# Receives a file or directory and search for it in the source paths.
|
869
|
+
#
|
870
|
+
# @raise [Error]
|
871
|
+
#
|
872
|
+
# source://thor//lib/thor/actions.rb#133
|
873
|
+
def find_in_source_paths(file); end
|
874
|
+
|
875
|
+
# Gets the content at the given address and places it at the given relative
|
876
|
+
# destination. If a block is given instead of destination, the content of
|
877
|
+
# the url is yielded and used as location.
|
878
|
+
#
|
879
|
+
# +get+ relies on open-uri, so passing application user input would provide
|
880
|
+
# a command injection attack vector.
|
881
|
+
#
|
882
|
+
# ==== Parameters
|
883
|
+
# source<String>:: the address of the given content.
|
884
|
+
# destination<String>:: the relative path to the destination root.
|
885
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
886
|
+
# :http_headers => <Hash> to add headers to an http request.
|
887
|
+
#
|
888
|
+
# ==== Examples
|
889
|
+
#
|
890
|
+
# get "http://gist.github.com/103208", "doc/README"
|
891
|
+
#
|
892
|
+
# get "http://gist.github.com/103208", "doc/README", :http_headers => {"Content-Type" => "application/json"}
|
893
|
+
#
|
894
|
+
# get "http://gist.github.com/103208" do |content|
|
895
|
+
# content.split("\n").first
|
896
|
+
# end
|
897
|
+
#
|
898
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#81
|
899
|
+
def get(source, *args, &block); end
|
900
|
+
|
901
|
+
# Run a regular expression replacement on a file.
|
902
|
+
#
|
903
|
+
# ==== Parameters
|
904
|
+
# path<String>:: path of the file to be changed
|
905
|
+
# flag<Regexp|String>:: the regexp or string to be replaced
|
906
|
+
# replacement<String>:: the replacement, can be also given as a block
|
907
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
908
|
+
# :force => true, to force the replacement regardless of runner behavior.
|
909
|
+
#
|
910
|
+
# ==== Example
|
911
|
+
#
|
912
|
+
# gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
|
913
|
+
#
|
914
|
+
# gsub_file 'README', /rake/, :green do |match|
|
915
|
+
# match << " no more. Use thor!"
|
916
|
+
# end
|
917
|
+
#
|
918
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#262
|
919
|
+
def gsub_file(path, flag, *args, &block); end
|
920
|
+
|
921
|
+
# Goes to the root and execute the given block.
|
922
|
+
#
|
923
|
+
# source://thor//lib/thor/actions.rb#200
|
924
|
+
def in_root; end
|
925
|
+
|
926
|
+
# Injects text right after the class definition. Since it depends on
|
927
|
+
# insert_into_file, it's reversible.
|
928
|
+
#
|
929
|
+
# ==== Parameters
|
930
|
+
# path<String>:: path of the file to be changed
|
931
|
+
# klass<String|Class>:: the class to be manipulated
|
932
|
+
# data<String>:: the data to append to the class, can be also given as a block.
|
933
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
934
|
+
#
|
935
|
+
# ==== Examples
|
936
|
+
#
|
937
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
|
938
|
+
#
|
939
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
940
|
+
# " filter_parameter :password\n"
|
941
|
+
# end
|
942
|
+
#
|
943
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#216
|
944
|
+
def inject_into_class(path, klass, *args, &block); end
|
945
|
+
|
946
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#26
|
947
|
+
def inject_into_file(destination, *args, &block); end
|
948
|
+
|
949
|
+
# Injects text right after the module definition. Since it depends on
|
950
|
+
# insert_into_file, it's reversible.
|
951
|
+
#
|
952
|
+
# ==== Parameters
|
953
|
+
# path<String>:: path of the file to be changed
|
954
|
+
# module_name<String|Class>:: the module to be manipulated
|
955
|
+
# data<String>:: the data to append to the class, can be also given as a block.
|
956
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
957
|
+
#
|
958
|
+
# ==== Examples
|
959
|
+
#
|
960
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
|
961
|
+
#
|
962
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
|
963
|
+
# " def help; 'help'; end\n"
|
964
|
+
# end
|
965
|
+
#
|
966
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#239
|
967
|
+
def inject_into_module(path, module_name, *args, &block); end
|
968
|
+
|
969
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#26
|
970
|
+
def insert_into_file(destination, *args, &block); end
|
971
|
+
|
972
|
+
# Do something in the root or on a provided subfolder. If a relative path
|
973
|
+
# is given it's referenced from the current root. The full path is yielded
|
974
|
+
# to the block you provide. The path is set back to the previous path when
|
975
|
+
# the method exits.
|
976
|
+
#
|
977
|
+
# Returns the value yielded by the block.
|
978
|
+
#
|
979
|
+
# ==== Parameters
|
980
|
+
# dir<String>:: the directory to move to.
|
981
|
+
# config<Hash>:: give :verbose => true to log and use padding.
|
982
|
+
#
|
983
|
+
# source://thor//lib/thor/actions.rb#170
|
984
|
+
def inside(dir = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
985
|
+
|
986
|
+
# Links the file from the relative source to the relative destination. If
|
987
|
+
# the destination is not given it's assumed to be equal to the source.
|
988
|
+
#
|
989
|
+
# ==== Parameters
|
990
|
+
# source<String>:: the relative path to the source root.
|
991
|
+
# destination<String>:: the relative path to the destination root.
|
992
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
993
|
+
#
|
994
|
+
# ==== Examples
|
995
|
+
#
|
996
|
+
# link_file "README", "doc/README"
|
997
|
+
#
|
998
|
+
# link_file "doc/README"
|
999
|
+
#
|
1000
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#50
|
1001
|
+
def link_file(source, *args); end
|
1002
|
+
|
1003
|
+
# Prepend text to a file. Since it depends on insert_into_file, it's reversible.
|
1004
|
+
#
|
1005
|
+
# ==== Parameters
|
1006
|
+
# path<String>:: path of the file to be changed
|
1007
|
+
# data<String>:: the data to prepend to the file, can be also given as a block.
|
1008
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1009
|
+
#
|
1010
|
+
# ==== Example
|
1011
|
+
#
|
1012
|
+
# prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
1013
|
+
#
|
1014
|
+
# prepend_to_file 'config/environments/test.rb' do
|
1015
|
+
# 'config.gem "rspec"'
|
1016
|
+
# end
|
1017
|
+
#
|
1018
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#170
|
1019
|
+
def prepend_file(path, *args, &block); end
|
1020
|
+
|
1021
|
+
# Prepend text to a file. Since it depends on insert_into_file, it's reversible.
|
1022
|
+
#
|
1023
|
+
# ==== Parameters
|
1024
|
+
# path<String>:: path of the file to be changed
|
1025
|
+
# data<String>:: the data to prepend to the file, can be also given as a block.
|
1026
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1027
|
+
#
|
1028
|
+
# ==== Example
|
1029
|
+
#
|
1030
|
+
# prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
1031
|
+
#
|
1032
|
+
# prepend_to_file 'config/environments/test.rb' do
|
1033
|
+
# 'config.gem "rspec"'
|
1034
|
+
# end
|
1035
|
+
#
|
1036
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#170
|
1037
|
+
def prepend_to_file(path, *args, &block); end
|
1038
|
+
|
1039
|
+
# Returns the given path relative to the absolute root (ie, root where
|
1040
|
+
# the script started).
|
1041
|
+
#
|
1042
|
+
# source://thor//lib/thor/actions.rb#114
|
1043
|
+
def relative_to_original_destination_root(path, remove_dot = T.unsafe(nil)); end
|
1044
|
+
|
1045
|
+
# Removes a file at the given location.
|
1046
|
+
#
|
1047
|
+
# ==== Parameters
|
1048
|
+
# path<String>:: path of the file to be changed
|
1049
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1050
|
+
#
|
1051
|
+
# ==== Example
|
1052
|
+
#
|
1053
|
+
# remove_file 'README'
|
1054
|
+
# remove_file 'app/controllers/application_controller.rb'
|
1055
|
+
#
|
1056
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#325
|
1057
|
+
def remove_dir(path, config = T.unsafe(nil)); end
|
1058
|
+
|
1059
|
+
# Removes a file at the given location.
|
1060
|
+
#
|
1061
|
+
# ==== Parameters
|
1062
|
+
# path<String>:: path of the file to be changed
|
1063
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1064
|
+
#
|
1065
|
+
# ==== Example
|
1066
|
+
#
|
1067
|
+
# remove_file 'README'
|
1068
|
+
# remove_file 'app/controllers/application_controller.rb'
|
1069
|
+
#
|
1070
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#325
|
1071
|
+
def remove_file(path, config = T.unsafe(nil)); end
|
1072
|
+
|
1073
|
+
# Executes a command returning the contents of the command.
|
1074
|
+
#
|
1075
|
+
# ==== Parameters
|
1076
|
+
# command<String>:: the command to be executed.
|
1077
|
+
# config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output. Specify :with
|
1078
|
+
# to append an executable to command execution.
|
1079
|
+
#
|
1080
|
+
# ==== Example
|
1081
|
+
#
|
1082
|
+
# inside('vendor') do
|
1083
|
+
# run('ln -s ~/edge rails')
|
1084
|
+
# end
|
1085
|
+
#
|
1086
|
+
# source://thor//lib/thor/actions.rb#248
|
1087
|
+
def run(command, config = T.unsafe(nil)); end
|
1088
|
+
|
1089
|
+
# Executes a ruby script (taking into account WIN32 platform quirks).
|
1090
|
+
#
|
1091
|
+
# ==== Parameters
|
1092
|
+
# command<String>:: the command to be executed.
|
1093
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1094
|
+
#
|
1095
|
+
# source://thor//lib/thor/actions.rb#285
|
1096
|
+
def run_ruby_script(command, config = T.unsafe(nil)); end
|
1097
|
+
|
1098
|
+
# Holds source paths in instance so they can be manipulated.
|
1099
|
+
#
|
1100
|
+
# source://thor//lib/thor/actions.rb#127
|
1101
|
+
def source_paths; end
|
1102
|
+
|
1103
|
+
# Gets an ERB template at the relative source, executes it and makes a copy
|
1104
|
+
# at the relative destination. If the destination is not given it's assumed
|
1105
|
+
# to be equal to the source removing .tt from the filename.
|
1106
|
+
#
|
1107
|
+
# ==== Parameters
|
1108
|
+
# source<String>:: the relative path to the source root.
|
1109
|
+
# destination<String>:: the relative path to the destination root.
|
1110
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1111
|
+
#
|
1112
|
+
# ==== Examples
|
1113
|
+
#
|
1114
|
+
# template "README", "doc/README"
|
1115
|
+
#
|
1116
|
+
# template "doc/README"
|
1117
|
+
#
|
1118
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#117
|
1119
|
+
def template(source, *args, &block); end
|
1120
|
+
|
1121
|
+
# Run a thor command. A hash of options can be given and it's converted to
|
1122
|
+
# switches.
|
1123
|
+
#
|
1124
|
+
# ==== Parameters
|
1125
|
+
# command<String>:: the command to be invoked
|
1126
|
+
# args<Array>:: arguments to the command
|
1127
|
+
# config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output.
|
1128
|
+
# Other options are given as parameter to Thor.
|
1129
|
+
#
|
1130
|
+
#
|
1131
|
+
# ==== Examples
|
1132
|
+
#
|
1133
|
+
# thor :install, "http://gist.github.com/103208"
|
1134
|
+
# #=> thor install http://gist.github.com/103208
|
1135
|
+
#
|
1136
|
+
# thor :list, :all => true, :substring => 'rails'
|
1137
|
+
# #=> thor list --all --substring=rails
|
1138
|
+
#
|
1139
|
+
# source://thor//lib/thor/actions.rb#308
|
1140
|
+
def thor(command, *args); end
|
1141
|
+
|
1142
|
+
# Uncomment all lines matching a given regex. Preserves indentation before
|
1143
|
+
# the comment hash and removes the hash and any immediate following space.
|
1144
|
+
#
|
1145
|
+
# ==== Parameters
|
1146
|
+
# path<String>:: path of the file to be changed
|
1147
|
+
# flag<Regexp|String>:: the regexp or string used to decide which lines to uncomment
|
1148
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1149
|
+
#
|
1150
|
+
# ==== Example
|
1151
|
+
#
|
1152
|
+
# uncomment_lines 'config/initializers/session_store.rb', /active_record/
|
1153
|
+
#
|
1154
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#289
|
1155
|
+
def uncomment_lines(path, flag, *args); end
|
1156
|
+
|
1157
|
+
protected
|
1158
|
+
|
1159
|
+
# source://thor//lib/thor/actions.rb#329
|
1160
|
+
def _cleanup_options_and_set(options, key); end
|
1161
|
+
|
1162
|
+
# Allow current root to be shared between invocations.
|
1163
|
+
#
|
1164
|
+
# source://thor//lib/thor/actions.rb#325
|
1165
|
+
def _shared_configuration; end
|
1166
|
+
|
1167
|
+
private
|
1168
|
+
|
1169
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#346
|
1170
|
+
def capture(*args); end
|
1171
|
+
|
1172
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#342
|
1173
|
+
def concat(string); end
|
1174
|
+
|
1175
|
+
# Returns the value of attribute output_buffer.
|
1176
|
+
#
|
1177
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#337
|
1178
|
+
def output_buffer; end
|
1179
|
+
|
1180
|
+
# Sets the attribute output_buffer
|
1181
|
+
#
|
1182
|
+
# @param value the value to set the attribute output_buffer to.
|
1183
|
+
#
|
1184
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#337
|
1185
|
+
def output_buffer=(_arg0); end
|
1186
|
+
|
1187
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#350
|
1188
|
+
def with_output_buffer(buf = T.unsafe(nil)); end
|
1189
|
+
|
1190
|
+
class << self
|
1191
|
+
# source://thor//lib/thor/actions.rb#12
|
1192
|
+
def included(base); end
|
1193
|
+
end
|
1194
|
+
end
|
1195
|
+
|
1196
|
+
# Thor::Actions#capture depends on what kind of buffer is used in ERB.
|
1197
|
+
# Thus CapturableERB fixes ERB to use String buffer.
|
1198
|
+
#
|
1199
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#362
|
1200
|
+
class Thor::Actions::CapturableERB < ::ERB
|
1201
|
+
# source://thor//lib/thor/actions/file_manipulation.rb#363
|
1202
|
+
def set_eoutvar(compiler, eoutvar = T.unsafe(nil)); end
|
1203
|
+
end
|
1204
|
+
|
1205
|
+
# source://thor//lib/thor/actions.rb#17
|
1206
|
+
module Thor::Actions::ClassMethods
|
1207
|
+
# Add runtime options that help actions execution.
|
1208
|
+
#
|
1209
|
+
# source://thor//lib/thor/actions.rb#48
|
1210
|
+
def add_runtime_options!; end
|
1211
|
+
|
1212
|
+
# Hold source paths for one Thor instance. source_paths_for_search is the
|
1213
|
+
# method responsible to gather source_paths from this current class,
|
1214
|
+
# inherited paths and the source root.
|
1215
|
+
#
|
1216
|
+
# source://thor//lib/thor/actions.rb#22
|
1217
|
+
def source_paths; end
|
1218
|
+
|
1219
|
+
# Returns the source paths in the following order:
|
1220
|
+
#
|
1221
|
+
# 1) This class source paths
|
1222
|
+
# 2) Source root
|
1223
|
+
# 3) Parents source paths
|
1224
|
+
#
|
1225
|
+
# source://thor//lib/thor/actions.rb#38
|
1226
|
+
def source_paths_for_search; end
|
1227
|
+
|
1228
|
+
# Stores and return the source root for this class
|
1229
|
+
#
|
1230
|
+
# source://thor//lib/thor/actions.rb#27
|
1231
|
+
def source_root(path = T.unsafe(nil)); end
|
1232
|
+
end
|
1233
|
+
|
1234
|
+
# CreateFile is a subset of Template, which instead of rendering a file with
|
1235
|
+
# ERB, it gets the content from the user.
|
1236
|
+
#
|
1237
|
+
# source://thor//lib/thor/actions/create_file.rb#32
|
1238
|
+
class Thor::Actions::CreateFile < ::Thor::Actions::EmptyDirectory
|
1239
|
+
# @return [CreateFile] a new instance of CreateFile
|
1240
|
+
#
|
1241
|
+
# source://thor//lib/thor/actions/create_file.rb#35
|
1242
|
+
def initialize(base, destination, data, config = T.unsafe(nil)); end
|
1243
|
+
|
1244
|
+
# source://thor//lib/thor/actions/create_file.rb#33
|
1245
|
+
def data; end
|
1246
|
+
|
1247
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
1248
|
+
#
|
1249
|
+
# ==== Returns
|
1250
|
+
# Boolean:: true if it is identical, false otherwise.
|
1251
|
+
#
|
1252
|
+
# @return [Boolean]
|
1253
|
+
#
|
1254
|
+
# source://thor//lib/thor/actions/create_file.rb#45
|
1255
|
+
def identical?; end
|
1256
|
+
|
1257
|
+
# source://thor//lib/thor/actions/create_file.rb#60
|
1258
|
+
def invoke!; end
|
1259
|
+
|
1260
|
+
# Holds the content to be added to the file.
|
1261
|
+
#
|
1262
|
+
# source://thor//lib/thor/actions/create_file.rb#52
|
1263
|
+
def render; end
|
1264
|
+
|
1265
|
+
protected
|
1266
|
+
|
1267
|
+
# Shows the file collision menu to the user and gets the result.
|
1268
|
+
#
|
1269
|
+
# @return [Boolean]
|
1270
|
+
#
|
1271
|
+
# source://thor//lib/thor/actions/create_file.rb#100
|
1272
|
+
def force_on_collision?; end
|
1273
|
+
|
1274
|
+
# If force is true, run the action, otherwise check if it's not being
|
1275
|
+
# skipped. If both are false, show the file_collision menu, if the menu
|
1276
|
+
# returns true, force it, otherwise skip.
|
1277
|
+
#
|
1278
|
+
# source://thor//lib/thor/actions/create_file.rb#86
|
1279
|
+
def force_or_skip_or_conflict(force, skip, &block); end
|
1280
|
+
|
1281
|
+
# Now on conflict we check if the file is identical or not.
|
1282
|
+
#
|
1283
|
+
# source://thor//lib/thor/actions/create_file.rb#73
|
1284
|
+
def on_conflict_behavior(&block); end
|
1285
|
+
end
|
1286
|
+
|
1287
|
+
# CreateLink is a subset of CreateFile, which instead of taking a block of
|
1288
|
+
# data, just takes a source string from the user.
|
1289
|
+
#
|
1290
|
+
# source://thor//lib/thor/actions/create_link.rb#27
|
1291
|
+
class Thor::Actions::CreateLink < ::Thor::Actions::CreateFile
|
1292
|
+
# source://thor//lib/thor/actions/create_link.rb#28
|
1293
|
+
def data; end
|
1294
|
+
|
1295
|
+
# @return [Boolean]
|
1296
|
+
#
|
1297
|
+
# source://thor//lib/thor/actions/create_link.rb#56
|
1298
|
+
def exists?; end
|
1299
|
+
|
1300
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
1301
|
+
#
|
1302
|
+
# ==== Returns
|
1303
|
+
# Boolean:: true if it is identical, false otherwise.
|
1304
|
+
#
|
1305
|
+
# @return [Boolean]
|
1306
|
+
#
|
1307
|
+
# source://thor//lib/thor/actions/create_link.rb#35
|
1308
|
+
def identical?; end
|
1309
|
+
|
1310
|
+
# source://thor//lib/thor/actions/create_link.rb#40
|
1311
|
+
def invoke!; end
|
1312
|
+
end
|
1313
|
+
|
1314
|
+
# source://thor//lib/thor/actions/directory.rb#55
|
1315
|
+
class Thor::Actions::Directory < ::Thor::Actions::EmptyDirectory
|
1316
|
+
# @return [Directory] a new instance of Directory
|
1317
|
+
#
|
1318
|
+
# source://thor//lib/thor/actions/directory.rb#58
|
1319
|
+
def initialize(base, source, destination = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
1320
|
+
|
1321
|
+
# source://thor//lib/thor/actions/directory.rb#64
|
1322
|
+
def invoke!; end
|
1323
|
+
|
1324
|
+
# source://thor//lib/thor/actions/directory.rb#69
|
1325
|
+
def revoke!; end
|
1326
|
+
|
1327
|
+
# Returns the value of attribute source.
|
1328
|
+
#
|
1329
|
+
# source://thor//lib/thor/actions/directory.rb#56
|
1330
|
+
def source; end
|
1331
|
+
|
1332
|
+
protected
|
1333
|
+
|
1334
|
+
# source://thor//lib/thor/actions/directory.rb#75
|
1335
|
+
def execute!; end
|
1336
|
+
|
1337
|
+
# source://thor//lib/thor/actions/directory.rb#99
|
1338
|
+
def file_level_lookup(previous_lookup); end
|
1339
|
+
|
1340
|
+
# source://thor//lib/thor/actions/directory.rb#103
|
1341
|
+
def files(lookup); end
|
1342
|
+
end
|
1343
|
+
|
1344
|
+
# source://thor//lib/thor/actions/empty_directory.rb#23
|
1345
|
+
class Thor::Actions::EmptyDirectory
|
1346
|
+
# Initializes given the source and destination.
|
1347
|
+
#
|
1348
|
+
# ==== Parameters
|
1349
|
+
# base<Thor::Base>:: A Thor::Base instance
|
1350
|
+
# source<String>:: Relative path to the source of this file
|
1351
|
+
# destination<String>:: Relative path to the destination of this file
|
1352
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
1353
|
+
#
|
1354
|
+
# @return [EmptyDirectory] a new instance of EmptyDirectory
|
1355
|
+
#
|
1356
|
+
# source://thor//lib/thor/actions/empty_directory.rb#34
|
1357
|
+
def initialize(base, destination, config = T.unsafe(nil)); end
|
1358
|
+
|
1359
|
+
# source://thor//lib/thor/actions/empty_directory.rb#24
|
1360
|
+
def base; end
|
1361
|
+
|
1362
|
+
# source://thor//lib/thor/actions/empty_directory.rb#24
|
1363
|
+
def config; end
|
1364
|
+
|
1365
|
+
# source://thor//lib/thor/actions/empty_directory.rb#24
|
1366
|
+
def destination; end
|
1367
|
+
|
1368
|
+
# Checks if the destination file already exists.
|
1369
|
+
#
|
1370
|
+
# ==== Returns
|
1371
|
+
# Boolean:: true if the file exists, false otherwise.
|
1372
|
+
#
|
1373
|
+
# @return [Boolean]
|
1374
|
+
#
|
1375
|
+
# source://thor//lib/thor/actions/empty_directory.rb#45
|
1376
|
+
def exists?; end
|
1377
|
+
|
1378
|
+
# source://thor//lib/thor/actions/empty_directory.rb#24
|
1379
|
+
def given_destination; end
|
1380
|
+
|
1381
|
+
# source://thor//lib/thor/actions/empty_directory.rb#49
|
1382
|
+
def invoke!; end
|
1383
|
+
|
1384
|
+
# source://thor//lib/thor/actions/empty_directory.rb#24
|
1385
|
+
def relative_destination; end
|
1386
|
+
|
1387
|
+
# source://thor//lib/thor/actions/empty_directory.rb#56
|
1388
|
+
def revoke!; end
|
1389
|
+
|
1390
|
+
protected
|
1391
|
+
|
1392
|
+
# Filenames in the encoded form are converted. If you have a file:
|
1393
|
+
#
|
1394
|
+
# %file_name%.rb
|
1395
|
+
#
|
1396
|
+
# It calls #file_name from the base and replaces %-string with the
|
1397
|
+
# return value (should be String) of #file_name:
|
1398
|
+
#
|
1399
|
+
# user.rb
|
1400
|
+
#
|
1401
|
+
# The method referenced can be either public or private.
|
1402
|
+
#
|
1403
|
+
# source://thor//lib/thor/actions/empty_directory.rb#103
|
1404
|
+
def convert_encoded_instructions(filename); end
|
1405
|
+
|
1406
|
+
# Sets the absolute destination value from a relative destination value.
|
1407
|
+
# It also stores the given and relative destination. Let's suppose our
|
1408
|
+
# script is being executed on "dest", it sets the destination root to
|
1409
|
+
# "dest". The destination, given_destination and relative_destination
|
1410
|
+
# are related in the following way:
|
1411
|
+
#
|
1412
|
+
# inside "bar" do
|
1413
|
+
# empty_directory "baz"
|
1414
|
+
# end
|
1415
|
+
#
|
1416
|
+
# destination #=> dest/bar/baz
|
1417
|
+
# relative_destination #=> bar/baz
|
1418
|
+
# given_destination #=> baz
|
1419
|
+
#
|
1420
|
+
# source://thor//lib/thor/actions/empty_directory.rb#85
|
1421
|
+
def destination=(destination); end
|
1422
|
+
|
1423
|
+
# Receives a hash of options and just execute the block if some
|
1424
|
+
# conditions are met.
|
1425
|
+
#
|
1426
|
+
# source://thor//lib/thor/actions/empty_directory.rb#113
|
1427
|
+
def invoke_with_conflict_check(&block); end
|
1428
|
+
|
1429
|
+
# What to do when the destination file already exists.
|
1430
|
+
#
|
1431
|
+
# source://thor//lib/thor/actions/empty_directory.rb#132
|
1432
|
+
def on_conflict_behavior; end
|
1433
|
+
|
1434
|
+
# source://thor//lib/thor/actions/empty_directory.rb#126
|
1435
|
+
def on_file_clash_behavior; end
|
1436
|
+
|
1437
|
+
# Shortcut for pretend.
|
1438
|
+
#
|
1439
|
+
# @return [Boolean]
|
1440
|
+
#
|
1441
|
+
# source://thor//lib/thor/actions/empty_directory.rb#67
|
1442
|
+
def pretend?; end
|
1443
|
+
|
1444
|
+
# Shortcut to say_status shell method.
|
1445
|
+
#
|
1446
|
+
# source://thor//lib/thor/actions/empty_directory.rb#138
|
1447
|
+
def say_status(status, color); end
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#36
|
1451
|
+
class Thor::Actions::InjectIntoFile < ::Thor::Actions::EmptyDirectory
|
1452
|
+
# @return [InjectIntoFile] a new instance of InjectIntoFile
|
1453
|
+
#
|
1454
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#39
|
1455
|
+
def initialize(base, destination, data, config); end
|
1456
|
+
|
1457
|
+
# Returns the value of attribute behavior.
|
1458
|
+
#
|
1459
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#37
|
1460
|
+
def behavior; end
|
1461
|
+
|
1462
|
+
# Returns the value of attribute flag.
|
1463
|
+
#
|
1464
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#37
|
1465
|
+
def flag; end
|
1466
|
+
|
1467
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#52
|
1468
|
+
def invoke!; end
|
1469
|
+
|
1470
|
+
# Returns the value of attribute replacement.
|
1471
|
+
#
|
1472
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#37
|
1473
|
+
def replacement; end
|
1474
|
+
|
1475
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#74
|
1476
|
+
def revoke!; end
|
1477
|
+
|
1478
|
+
protected
|
1479
|
+
|
1480
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#110
|
1481
|
+
def content; end
|
1482
|
+
|
1483
|
+
# Adds the content to the file.
|
1484
|
+
#
|
1485
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#120
|
1486
|
+
def replace!(regexp, string, force); end
|
1487
|
+
|
1488
|
+
# @return [Boolean]
|
1489
|
+
#
|
1490
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#114
|
1491
|
+
def replacement_present?; end
|
1492
|
+
|
1493
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#90
|
1494
|
+
def say_status(behavior, warning: T.unsafe(nil), color: T.unsafe(nil)); end
|
1495
|
+
end
|
1496
|
+
|
1497
|
+
# Injects the given content into a file. Different from gsub_file, this
|
1498
|
+
# method is reversible.
|
1499
|
+
#
|
1500
|
+
# ==== Parameters
|
1501
|
+
# destination<String>:: Relative path to the destination root
|
1502
|
+
# data<String>:: Data to add to the file. Can be given as a block.
|
1503
|
+
# config<Hash>:: give :verbose => false to not log the status and the flag
|
1504
|
+
# for injection (:after or :before) or :force => true for
|
1505
|
+
# insert two or more times the same content.
|
1506
|
+
#
|
1507
|
+
# ==== Examples
|
1508
|
+
#
|
1509
|
+
# insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
|
1510
|
+
#
|
1511
|
+
# insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
|
1512
|
+
# gems = ask "Which gems would you like to add?"
|
1513
|
+
# gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
|
1514
|
+
# end
|
1515
|
+
#
|
1516
|
+
# source://thor//lib/thor/actions/inject_into_file.rb#24
|
1517
|
+
Thor::Actions::WARNINGS = T.let(T.unsafe(nil), Hash)
|
1518
|
+
|
1519
|
+
# source://thor//lib/thor/error.rb#57
|
1520
|
+
class Thor::AmbiguousCommandError < ::Thor::Error; end
|
1521
|
+
|
1522
|
+
# source://thor//lib/thor/error.rb#59
|
1523
|
+
Thor::AmbiguousTaskError = Thor::AmbiguousCommandError
|
1524
|
+
|
1525
|
+
# source://thor//lib/thor/parser/argument.rb#2
|
1526
|
+
class Thor::Argument
|
1527
|
+
# @raise [ArgumentError]
|
1528
|
+
# @return [Argument] a new instance of Argument
|
1529
|
+
#
|
1530
|
+
# source://thor//lib/thor/parser/argument.rb#8
|
1531
|
+
def initialize(name, options = T.unsafe(nil)); end
|
1532
|
+
|
1533
|
+
# Returns the value of attribute banner.
|
1534
|
+
#
|
1535
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1536
|
+
def banner; end
|
1537
|
+
|
1538
|
+
# Returns the value of attribute default.
|
1539
|
+
#
|
1540
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1541
|
+
def default; end
|
1542
|
+
|
1543
|
+
# Returns the value of attribute description.
|
1544
|
+
#
|
1545
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1546
|
+
def description; end
|
1547
|
+
|
1548
|
+
# Returns the value of attribute enum.
|
1549
|
+
#
|
1550
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1551
|
+
def enum; end
|
1552
|
+
|
1553
|
+
# source://thor//lib/thor/parser/argument.rb#52
|
1554
|
+
def enum_to_s; end
|
1555
|
+
|
1556
|
+
# Returns the value of attribute name.
|
1557
|
+
#
|
1558
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1559
|
+
def human_name; end
|
1560
|
+
|
1561
|
+
# Returns the value of attribute name.
|
1562
|
+
#
|
1563
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1564
|
+
def name; end
|
1565
|
+
|
1566
|
+
# source://thor//lib/thor/parser/argument.rb#27
|
1567
|
+
def print_default; end
|
1568
|
+
|
1569
|
+
# Returns the value of attribute required.
|
1570
|
+
#
|
1571
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1572
|
+
def required; end
|
1573
|
+
|
1574
|
+
# @return [Boolean]
|
1575
|
+
#
|
1576
|
+
# source://thor//lib/thor/parser/argument.rb#39
|
1577
|
+
def required?; end
|
1578
|
+
|
1579
|
+
# @return [Boolean]
|
1580
|
+
#
|
1581
|
+
# source://thor//lib/thor/parser/argument.rb#43
|
1582
|
+
def show_default?; end
|
1583
|
+
|
1584
|
+
# Returns the value of attribute type.
|
1585
|
+
#
|
1586
|
+
# source://thor//lib/thor/parser/argument.rb#5
|
1587
|
+
def type; end
|
1588
|
+
|
1589
|
+
# source://thor//lib/thor/parser/argument.rb#35
|
1590
|
+
def usage; end
|
1591
|
+
|
1592
|
+
protected
|
1593
|
+
|
1594
|
+
# source://thor//lib/thor/parser/argument.rb#71
|
1595
|
+
def default_banner; end
|
1596
|
+
|
1597
|
+
# @return [Boolean]
|
1598
|
+
#
|
1599
|
+
# source://thor//lib/thor/parser/argument.rb#67
|
1600
|
+
def valid_type?(type); end
|
1601
|
+
|
1602
|
+
# @raise [ArgumentError]
|
1603
|
+
#
|
1604
|
+
# source://thor//lib/thor/parser/argument.rb#62
|
1605
|
+
def validate!; end
|
1606
|
+
end
|
1607
|
+
|
1608
|
+
# source://thor//lib/thor/parser/argument.rb#3
|
1609
|
+
Thor::Argument::VALID_TYPES = T.let(T.unsafe(nil), Array)
|
1610
|
+
|
1611
|
+
# source://thor//lib/thor/parser/arguments.rb#2
|
1612
|
+
class Thor::Arguments
|
1613
|
+
# Takes an array of Thor::Argument objects.
|
1614
|
+
#
|
1615
|
+
# @return [Arguments] a new instance of Arguments
|
1616
|
+
#
|
1617
|
+
# source://thor//lib/thor/parser/arguments.rb#26
|
1618
|
+
def initialize(arguments = T.unsafe(nil)); end
|
1619
|
+
|
1620
|
+
# source://thor//lib/thor/parser/arguments.rb#40
|
1621
|
+
def parse(args); end
|
1622
|
+
|
1623
|
+
# source://thor//lib/thor/parser/arguments.rb#53
|
1624
|
+
def remaining; end
|
1625
|
+
|
1626
|
+
private
|
1627
|
+
|
1628
|
+
# Raises an error if @non_assigned_required array is not empty.
|
1629
|
+
#
|
1630
|
+
# @raise [RequiredArgumentMissingError]
|
1631
|
+
#
|
1632
|
+
# source://thor//lib/thor/parser/arguments.rb#186
|
1633
|
+
def check_requirement!; end
|
1634
|
+
|
1635
|
+
# @return [Boolean]
|
1636
|
+
#
|
1637
|
+
# source://thor//lib/thor/parser/arguments.rb#84
|
1638
|
+
def current_is_value?; end
|
1639
|
+
|
1640
|
+
# @return [Boolean]
|
1641
|
+
#
|
1642
|
+
# source://thor//lib/thor/parser/arguments.rb#64
|
1643
|
+
def last?; end
|
1644
|
+
|
1645
|
+
# @return [Boolean]
|
1646
|
+
#
|
1647
|
+
# source://thor//lib/thor/parser/arguments.rb#59
|
1648
|
+
def no_or_skip?(arg); end
|
1649
|
+
|
1650
|
+
# Runs through the argument array getting all strings until no string is
|
1651
|
+
# found or a switch is found.
|
1652
|
+
#
|
1653
|
+
# ["a", "b", "c"]
|
1654
|
+
#
|
1655
|
+
# And returns it as an array:
|
1656
|
+
#
|
1657
|
+
# ["a", "b", "c"]
|
1658
|
+
#
|
1659
|
+
# source://thor//lib/thor/parser/arguments.rb#118
|
1660
|
+
def parse_array(name); end
|
1661
|
+
|
1662
|
+
# Runs through the argument array getting strings that contains ":" and
|
1663
|
+
# mark it as a hash:
|
1664
|
+
#
|
1665
|
+
# [ "name:string", "age:integer" ]
|
1666
|
+
#
|
1667
|
+
# Becomes:
|
1668
|
+
#
|
1669
|
+
# { "name" => "string", "age" => "integer" }
|
1670
|
+
#
|
1671
|
+
# source://thor//lib/thor/parser/arguments.rb#97
|
1672
|
+
def parse_hash(name); end
|
1673
|
+
|
1674
|
+
# Check if the peek is numeric format and return a Float or Integer.
|
1675
|
+
# Check if the peek is included in enum if enum is provided.
|
1676
|
+
# Otherwise raises an error.
|
1677
|
+
#
|
1678
|
+
# source://thor//lib/thor/parser/arguments.rb#139
|
1679
|
+
def parse_numeric(name); end
|
1680
|
+
|
1681
|
+
# Parse string:
|
1682
|
+
# for --string-arg, just return the current value in the pile
|
1683
|
+
# for --no-string-arg, nil
|
1684
|
+
# Check if the peek is included in enum if enum is provided. Otherwise raises an error.
|
1685
|
+
#
|
1686
|
+
# source://thor//lib/thor/parser/arguments.rb#158
|
1687
|
+
def parse_string(name); end
|
1688
|
+
|
1689
|
+
# source://thor//lib/thor/parser/arguments.rb#68
|
1690
|
+
def peek; end
|
1691
|
+
|
1692
|
+
# source://thor//lib/thor/parser/arguments.rb#72
|
1693
|
+
def shift; end
|
1694
|
+
|
1695
|
+
# source://thor//lib/thor/parser/arguments.rb#76
|
1696
|
+
def unshift(arg); end
|
1697
|
+
|
1698
|
+
# Raises an error if the switch is an enum and the values aren't included on it.
|
1699
|
+
#
|
1700
|
+
# source://thor//lib/thor/parser/arguments.rb#172
|
1701
|
+
def validate_enum_value!(name, value, message); end
|
1702
|
+
|
1703
|
+
class << self
|
1704
|
+
# source://thor//lib/thor/parser/arguments.rb#19
|
1705
|
+
def parse(*args); end
|
1706
|
+
|
1707
|
+
# Receives an array of args and returns two arrays, one with arguments
|
1708
|
+
# and one with switches.
|
1709
|
+
#
|
1710
|
+
# source://thor//lib/thor/parser/arguments.rb#8
|
1711
|
+
def split(args); end
|
1712
|
+
end
|
1713
|
+
end
|
1714
|
+
|
1715
|
+
# source://thor//lib/thor/parser/arguments.rb#3
|
1716
|
+
Thor::Arguments::NUMERIC = T.let(T.unsafe(nil), Regexp)
|
1717
|
+
|
1718
|
+
# source://thor//lib/thor/error.rb#104
|
1719
|
+
class Thor::AtLeastOneRequiredArgumentError < ::Thor::InvocationError; end
|
1720
|
+
|
1721
|
+
# source://thor//lib/thor/shell.rb#4
|
1722
|
+
module Thor::Base
|
1723
|
+
include ::Thor::Invocation
|
1724
|
+
include ::Thor::Shell
|
1725
|
+
|
1726
|
+
mixes_in_class_methods ::Thor::Base::ClassMethods
|
1727
|
+
mixes_in_class_methods ::Thor::Invocation::ClassMethods
|
1728
|
+
|
1729
|
+
# It receives arguments in an Array and two hashes, one for options and
|
1730
|
+
# other for configuration.
|
1731
|
+
#
|
1732
|
+
# Notice that it does not check if all required arguments were supplied.
|
1733
|
+
# It should be done by the parser.
|
1734
|
+
#
|
1735
|
+
# ==== Parameters
|
1736
|
+
# args<Array[Object]>:: An array of objects. The objects are applied to their
|
1737
|
+
# respective accessors declared with <tt>argument</tt>.
|
1738
|
+
#
|
1739
|
+
# options<Hash>:: An options hash that will be available as self.options.
|
1740
|
+
# The hash given is converted to a hash with indifferent
|
1741
|
+
# access, magic predicates (options.skip?) and then frozen.
|
1742
|
+
#
|
1743
|
+
# config<Hash>:: Configuration for this Thor class.
|
1744
|
+
#
|
1745
|
+
# source://thor//lib/thor/base.rb#53
|
1746
|
+
def initialize(args = T.unsafe(nil), local_options = T.unsafe(nil), config = T.unsafe(nil)); end
|
1747
|
+
|
1748
|
+
# Returns the value of attribute args.
|
1749
|
+
#
|
1750
|
+
# source://thor//lib/thor/base.rb#35
|
1751
|
+
def args; end
|
1752
|
+
|
1753
|
+
# Sets the attribute args
|
1754
|
+
#
|
1755
|
+
# @param value the value to set the attribute args to.
|
1756
|
+
#
|
1757
|
+
# source://thor//lib/thor/base.rb#35
|
1758
|
+
def args=(_arg0); end
|
1759
|
+
|
1760
|
+
# Returns the value of attribute options.
|
1761
|
+
#
|
1762
|
+
# source://thor//lib/thor/base.rb#35
|
1763
|
+
def options; end
|
1764
|
+
|
1765
|
+
# Sets the attribute options
|
1766
|
+
#
|
1767
|
+
# @param value the value to set the attribute options to.
|
1768
|
+
#
|
1769
|
+
# source://thor//lib/thor/base.rb#35
|
1770
|
+
def options=(_arg0); end
|
1771
|
+
|
1772
|
+
# Returns the value of attribute parent_options.
|
1773
|
+
#
|
1774
|
+
# source://thor//lib/thor/base.rb#35
|
1775
|
+
def parent_options; end
|
1776
|
+
|
1777
|
+
# Sets the attribute parent_options
|
1778
|
+
#
|
1779
|
+
# @param value the value to set the attribute parent_options to.
|
1780
|
+
#
|
1781
|
+
# source://thor//lib/thor/base.rb#35
|
1782
|
+
def parent_options=(_arg0); end
|
1783
|
+
|
1784
|
+
class << self
|
1785
|
+
# source://thor//lib/thor/base.rb#116
|
1786
|
+
def included(base); end
|
1787
|
+
|
1788
|
+
# Whenever a class inherits from Thor or Thor::Group, we should track the
|
1789
|
+
# class and the file on Thor::Base. This is the method responsible for it.
|
1790
|
+
#
|
1791
|
+
# source://thor//lib/thor/base.rb#144
|
1792
|
+
def register_klass_file(klass); end
|
1793
|
+
|
1794
|
+
# Returns the shell used in all Thor classes. If you are in a Unix platform
|
1795
|
+
# it will use a colored log, otherwise it will use a basic one without color.
|
1796
|
+
#
|
1797
|
+
# source://thor//lib/thor/shell.rb#11
|
1798
|
+
def shell; end
|
1799
|
+
|
1800
|
+
# Sets the attribute shell
|
1801
|
+
#
|
1802
|
+
# @param value the value to set the attribute shell to.
|
1803
|
+
#
|
1804
|
+
# source://thor//lib/thor/shell.rb#6
|
1805
|
+
def shell=(_arg0); end
|
1806
|
+
|
1807
|
+
# Returns the files where the subclasses are kept.
|
1808
|
+
#
|
1809
|
+
# ==== Returns
|
1810
|
+
# Hash[path<String> => Class]
|
1811
|
+
#
|
1812
|
+
# source://thor//lib/thor/base.rb#137
|
1813
|
+
def subclass_files; end
|
1814
|
+
|
1815
|
+
# Returns the classes that inherits from Thor or Thor::Group.
|
1816
|
+
#
|
1817
|
+
# ==== Returns
|
1818
|
+
# Array[Class]
|
1819
|
+
#
|
1820
|
+
# source://thor//lib/thor/base.rb#128
|
1821
|
+
def subclasses; end
|
1822
|
+
end
|
1823
|
+
end
|
1824
|
+
|
1825
|
+
# source://thor//lib/thor/base.rb#153
|
1826
|
+
module Thor::Base::ClassMethods
|
1827
|
+
# Returns the commands for this Thor class and all subclasses.
|
1828
|
+
#
|
1829
|
+
# ==== Returns
|
1830
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1831
|
+
# objects as values.
|
1832
|
+
#
|
1833
|
+
# source://thor//lib/thor/base.rb#482
|
1834
|
+
def all_commands; end
|
1835
|
+
|
1836
|
+
# Returns the commands for this Thor class and all subclasses.
|
1837
|
+
#
|
1838
|
+
# ==== Returns
|
1839
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1840
|
+
# objects as values.
|
1841
|
+
#
|
1842
|
+
# source://thor//lib/thor/base.rb#482
|
1843
|
+
def all_tasks; end
|
1844
|
+
|
1845
|
+
# If you want to use defaults that don't match the type of an option,
|
1846
|
+
# either specify `check_default_type: false` or call `allow_incompatible_default_type!`
|
1847
|
+
#
|
1848
|
+
# source://thor//lib/thor/base.rb#189
|
1849
|
+
def allow_incompatible_default_type!; end
|
1850
|
+
|
1851
|
+
# Adds an argument to the class and creates an attr_accessor for it.
|
1852
|
+
#
|
1853
|
+
# Arguments are different from options in several aspects. The first one
|
1854
|
+
# is how they are parsed from the command line, arguments are retrieved
|
1855
|
+
# from position:
|
1856
|
+
#
|
1857
|
+
# thor command NAME
|
1858
|
+
#
|
1859
|
+
# Instead of:
|
1860
|
+
#
|
1861
|
+
# thor command --name=NAME
|
1862
|
+
#
|
1863
|
+
# Besides, arguments are used inside your code as an accessor (self.argument),
|
1864
|
+
# while options are all kept in a hash (self.options).
|
1865
|
+
#
|
1866
|
+
# Finally, arguments cannot have type :default or :boolean but can be
|
1867
|
+
# optional (supplying :optional => :true or :required => false), although
|
1868
|
+
# you cannot have a required argument after a non-required argument. If you
|
1869
|
+
# try it, an error is raised.
|
1870
|
+
#
|
1871
|
+
# ==== Parameters
|
1872
|
+
# name<Symbol>:: The name of the argument.
|
1873
|
+
# options<Hash>:: Described below.
|
1874
|
+
#
|
1875
|
+
# ==== Options
|
1876
|
+
# :desc - Description for the argument.
|
1877
|
+
# :required - If the argument is required or not.
|
1878
|
+
# :optional - If the argument is optional or not.
|
1879
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric.
|
1880
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
1881
|
+
# :banner - String to show on usage notes.
|
1882
|
+
#
|
1883
|
+
# ==== Errors
|
1884
|
+
# ArgumentError:: Raised if you supply a required argument after a non required one.
|
1885
|
+
#
|
1886
|
+
# source://thor//lib/thor/base.rb#261
|
1887
|
+
def argument(name, options = T.unsafe(nil)); end
|
1888
|
+
|
1889
|
+
# Returns this class arguments, looking up in the ancestors chain.
|
1890
|
+
#
|
1891
|
+
# ==== Returns
|
1892
|
+
# Array[Thor::Argument]
|
1893
|
+
#
|
1894
|
+
# source://thor//lib/thor/base.rb#293
|
1895
|
+
def arguments; end
|
1896
|
+
|
1897
|
+
# source://thor//lib/thor/base.rb#162
|
1898
|
+
def attr_accessor(*_arg0); end
|
1899
|
+
|
1900
|
+
# source://thor//lib/thor/base.rb#154
|
1901
|
+
def attr_reader(*_arg0); end
|
1902
|
+
|
1903
|
+
# source://thor//lib/thor/base.rb#158
|
1904
|
+
def attr_writer(*_arg0); end
|
1905
|
+
|
1906
|
+
# source://thor//lib/thor/base.rb#193
|
1907
|
+
def check_default_type; end
|
1908
|
+
|
1909
|
+
# If you want to raise an error when the default value of an option does not match
|
1910
|
+
# the type call check_default_type!
|
1911
|
+
# This will be the default; for compatibility a deprecation warning is issued if necessary.
|
1912
|
+
#
|
1913
|
+
# source://thor//lib/thor/base.rb#183
|
1914
|
+
def check_default_type!; end
|
1915
|
+
|
1916
|
+
# source://thor//lib/thor/base.rb#172
|
1917
|
+
def check_unknown_options; end
|
1918
|
+
|
1919
|
+
# If you want to raise an error for unknown options, call check_unknown_options!
|
1920
|
+
# This is disabled by default to allow dynamic invocations.
|
1921
|
+
#
|
1922
|
+
# source://thor//lib/thor/base.rb#168
|
1923
|
+
def check_unknown_options!; end
|
1924
|
+
|
1925
|
+
# @return [Boolean]
|
1926
|
+
#
|
1927
|
+
# source://thor//lib/thor/base.rb#176
|
1928
|
+
def check_unknown_options?(config); end
|
1929
|
+
|
1930
|
+
# Adds and declares option group for required at least one of options in the
|
1931
|
+
# block and arguments. You can declare options as the outside of the block.
|
1932
|
+
#
|
1933
|
+
# ==== Examples
|
1934
|
+
#
|
1935
|
+
# class_at_least_one do
|
1936
|
+
# class_option :one
|
1937
|
+
# class_option :two
|
1938
|
+
# end
|
1939
|
+
#
|
1940
|
+
# Or
|
1941
|
+
#
|
1942
|
+
# class_option :one
|
1943
|
+
# class_option :two
|
1944
|
+
# class_at_least_one :one, :two
|
1945
|
+
#
|
1946
|
+
# If you do not give "--one" and "--two" AtLeastOneRequiredArgumentError
|
1947
|
+
# will be raised.
|
1948
|
+
#
|
1949
|
+
# You can use class_at_least_one and class_exclusive at the same time.
|
1950
|
+
#
|
1951
|
+
# class_exclusive do
|
1952
|
+
# class_at_least_one do
|
1953
|
+
# class_option :one
|
1954
|
+
# class_option :two
|
1955
|
+
# end
|
1956
|
+
# end
|
1957
|
+
#
|
1958
|
+
# Then it is required either only one of "--one" or "--two".
|
1959
|
+
#
|
1960
|
+
# source://thor//lib/thor/base.rb#392
|
1961
|
+
def class_at_least_one(*args, &block); end
|
1962
|
+
|
1963
|
+
# Returns this class at least one of required options array set, looking up in the ancestors chain.
|
1964
|
+
#
|
1965
|
+
# ==== Returns
|
1966
|
+
# Array[Array[Thor::Option.name]]
|
1967
|
+
#
|
1968
|
+
# source://thor//lib/thor/base.rb#411
|
1969
|
+
def class_at_least_one_option_names; end
|
1970
|
+
|
1971
|
+
# Adds and declares option group for exclusive options in the
|
1972
|
+
# block and arguments. You can declare options as the outside of the block.
|
1973
|
+
#
|
1974
|
+
# ==== Parameters
|
1975
|
+
# Array[Thor::Option.name]
|
1976
|
+
#
|
1977
|
+
# ==== Examples
|
1978
|
+
#
|
1979
|
+
# class_exclusive do
|
1980
|
+
# class_option :one
|
1981
|
+
# class_option :two
|
1982
|
+
# end
|
1983
|
+
#
|
1984
|
+
# Or
|
1985
|
+
#
|
1986
|
+
# class_option :one
|
1987
|
+
# class_option :two
|
1988
|
+
# class_exclusive :one, :two
|
1989
|
+
#
|
1990
|
+
# If you give "--one" and "--two" at the same time ExclusiveArgumentsError
|
1991
|
+
# will be raised.
|
1992
|
+
#
|
1993
|
+
# source://thor//lib/thor/base.rb#357
|
1994
|
+
def class_exclusive(*args, &block); end
|
1995
|
+
|
1996
|
+
# Returns this class exclusive options array set, looking up in the ancestors chain.
|
1997
|
+
#
|
1998
|
+
# ==== Returns
|
1999
|
+
# Array[Array[Thor::Option.name]]
|
2000
|
+
#
|
2001
|
+
# source://thor//lib/thor/base.rb#402
|
2002
|
+
def class_exclusive_option_names; end
|
2003
|
+
|
2004
|
+
# Adds an option to the set of class options
|
2005
|
+
#
|
2006
|
+
# ==== Parameters
|
2007
|
+
# name<Symbol>:: The name of the argument.
|
2008
|
+
# options<Hash>:: Described below.
|
2009
|
+
#
|
2010
|
+
# ==== Options
|
2011
|
+
# :desc:: -- Description for the argument.
|
2012
|
+
# :required:: -- If the argument is required or not.
|
2013
|
+
# :default:: -- Default value for this argument.
|
2014
|
+
# :group:: -- The group for this options. Use by class options to output options in different levels.
|
2015
|
+
# :aliases:: -- Aliases for this option. <b>Note:</b> Thor follows a convention of one-dash-one-letter options. Thus aliases like "-something" wouldn't be parsed; use either "\--something" or "-s" instead.
|
2016
|
+
# :type:: -- The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
2017
|
+
# :banner:: -- String to show on usage notes.
|
2018
|
+
# :hide:: -- If you want to hide this option from the help.
|
2019
|
+
#
|
2020
|
+
# source://thor//lib/thor/base.rb#328
|
2021
|
+
def class_option(name, options = T.unsafe(nil)); end
|
2022
|
+
|
2023
|
+
# Adds a bunch of options to the set of class options.
|
2024
|
+
#
|
2025
|
+
# class_options :foo => false, :bar => :required, :baz => :string
|
2026
|
+
#
|
2027
|
+
# If you prefer more detailed declaration, check class_option.
|
2028
|
+
#
|
2029
|
+
# ==== Parameters
|
2030
|
+
# Hash[Symbol => Object]
|
2031
|
+
#
|
2032
|
+
# source://thor//lib/thor/base.rb#306
|
2033
|
+
def class_options(options = T.unsafe(nil)); end
|
2034
|
+
|
2035
|
+
# Returns the commands for this Thor class.
|
2036
|
+
#
|
2037
|
+
# ==== Returns
|
2038
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
2039
|
+
# objects as values.
|
2040
|
+
#
|
2041
|
+
# source://thor//lib/thor/base.rb#471
|
2042
|
+
def commands; end
|
2043
|
+
|
2044
|
+
# If true, option set will not suspend the execution of the command when
|
2045
|
+
# a required option is not provided.
|
2046
|
+
#
|
2047
|
+
# @return [Boolean]
|
2048
|
+
#
|
2049
|
+
# source://thor//lib/thor/base.rb#207
|
2050
|
+
def disable_required_check?(command_name); end
|
2051
|
+
|
2052
|
+
# A flag that makes the process exit with status 1 if any error happens.
|
2053
|
+
#
|
2054
|
+
# @return [Boolean]
|
2055
|
+
#
|
2056
|
+
# source://thor//lib/thor/base.rb#628
|
2057
|
+
def exit_on_failure?; end
|
2058
|
+
|
2059
|
+
# Defines the group. This is used when thor list is invoked so you can specify
|
2060
|
+
# that only commands from a pre-defined group will be shown. Defaults to standard.
|
2061
|
+
#
|
2062
|
+
# ==== Parameters
|
2063
|
+
# name<String|Symbol>
|
2064
|
+
#
|
2065
|
+
# source://thor//lib/thor/base.rb#457
|
2066
|
+
def group(name = T.unsafe(nil)); end
|
2067
|
+
|
2068
|
+
# @raise [InvocationError]
|
2069
|
+
#
|
2070
|
+
# source://thor//lib/thor/base.rb#618
|
2071
|
+
def handle_argument_error(command, error, args, arity); end
|
2072
|
+
|
2073
|
+
# @raise [UndefinedCommandError]
|
2074
|
+
#
|
2075
|
+
# source://thor//lib/thor/base.rb#613
|
2076
|
+
def handle_no_command_error(command, has_namespace = T.unsafe(nil)); end
|
2077
|
+
|
2078
|
+
# @raise [UndefinedCommandError]
|
2079
|
+
#
|
2080
|
+
# source://thor//lib/thor/base.rb#613
|
2081
|
+
def handle_no_task_error(command, has_namespace = T.unsafe(nil)); end
|
2082
|
+
|
2083
|
+
# Sets the namespace for the Thor or Thor::Group class. By default the
|
2084
|
+
# namespace is retrieved from the class name. If your Thor class is named
|
2085
|
+
# Scripts::MyScript, the help method, for example, will be called as:
|
2086
|
+
#
|
2087
|
+
# thor scripts:my_script -h
|
2088
|
+
#
|
2089
|
+
# If you change the namespace:
|
2090
|
+
#
|
2091
|
+
# namespace :my_scripts
|
2092
|
+
#
|
2093
|
+
# You change how your commands are invoked:
|
2094
|
+
#
|
2095
|
+
# thor my_scripts -h
|
2096
|
+
#
|
2097
|
+
# Finally, if you change your namespace to default:
|
2098
|
+
#
|
2099
|
+
# namespace :default
|
2100
|
+
#
|
2101
|
+
# Your commands can be invoked with a shortcut. Instead of:
|
2102
|
+
#
|
2103
|
+
# thor :my_command
|
2104
|
+
#
|
2105
|
+
# source://thor//lib/thor/base.rb#566
|
2106
|
+
def namespace(name = T.unsafe(nil)); end
|
2107
|
+
|
2108
|
+
# All methods defined inside the given block are not added as commands.
|
2109
|
+
#
|
2110
|
+
# So you can do:
|
2111
|
+
#
|
2112
|
+
# class MyScript < Thor
|
2113
|
+
# no_commands do
|
2114
|
+
# def this_is_not_a_command
|
2115
|
+
# end
|
2116
|
+
# end
|
2117
|
+
# end
|
2118
|
+
#
|
2119
|
+
# You can also add the method and remove it from the command list:
|
2120
|
+
#
|
2121
|
+
# class MyScript < Thor
|
2122
|
+
# def this_is_not_a_command
|
2123
|
+
# end
|
2124
|
+
# remove_command :this_is_not_a_command
|
2125
|
+
# end
|
2126
|
+
#
|
2127
|
+
# source://thor//lib/thor/base.rb#530
|
2128
|
+
def no_commands(&block); end
|
2129
|
+
|
2130
|
+
# @return [Boolean]
|
2131
|
+
#
|
2132
|
+
# source://thor//lib/thor/base.rb#540
|
2133
|
+
def no_commands?; end
|
2134
|
+
|
2135
|
+
# source://thor//lib/thor/base.rb#536
|
2136
|
+
def no_commands_context; end
|
2137
|
+
|
2138
|
+
# All methods defined inside the given block are not added as commands.
|
2139
|
+
#
|
2140
|
+
# So you can do:
|
2141
|
+
#
|
2142
|
+
# class MyScript < Thor
|
2143
|
+
# no_commands do
|
2144
|
+
# def this_is_not_a_command
|
2145
|
+
# end
|
2146
|
+
# end
|
2147
|
+
# end
|
2148
|
+
#
|
2149
|
+
# You can also add the method and remove it from the command list:
|
2150
|
+
#
|
2151
|
+
# class MyScript < Thor
|
2152
|
+
# def this_is_not_a_command
|
2153
|
+
# end
|
2154
|
+
# remove_command :this_is_not_a_command
|
2155
|
+
# end
|
2156
|
+
#
|
2157
|
+
# source://thor//lib/thor/base.rb#530
|
2158
|
+
def no_tasks(&block); end
|
2159
|
+
|
2160
|
+
# Allows to use private methods from parent in child classes as commands.
|
2161
|
+
#
|
2162
|
+
# ==== Parameters
|
2163
|
+
# names<Array>:: Method names to be used as commands
|
2164
|
+
#
|
2165
|
+
# ==== Examples
|
2166
|
+
#
|
2167
|
+
# public_command :foo
|
2168
|
+
# public_command :foo, :bar, :baz
|
2169
|
+
#
|
2170
|
+
# source://thor//lib/thor/base.rb#606
|
2171
|
+
def public_command(*names); end
|
2172
|
+
|
2173
|
+
# Allows to use private methods from parent in child classes as commands.
|
2174
|
+
#
|
2175
|
+
# ==== Parameters
|
2176
|
+
# names<Array>:: Method names to be used as commands
|
2177
|
+
#
|
2178
|
+
# ==== Examples
|
2179
|
+
#
|
2180
|
+
# public_command :foo
|
2181
|
+
# public_command :foo, :bar, :baz
|
2182
|
+
#
|
2183
|
+
# source://thor//lib/thor/base.rb#606
|
2184
|
+
def public_task(*names); end
|
2185
|
+
|
2186
|
+
# Removes a previous defined argument. If :undefine is given, undefine
|
2187
|
+
# accessors as well.
|
2188
|
+
#
|
2189
|
+
# ==== Parameters
|
2190
|
+
# names<Array>:: Arguments to be removed
|
2191
|
+
#
|
2192
|
+
# ==== Examples
|
2193
|
+
#
|
2194
|
+
# remove_argument :foo
|
2195
|
+
# remove_argument :foo, :bar, :baz, :undefine => true
|
2196
|
+
#
|
2197
|
+
# source://thor//lib/thor/base.rb#426
|
2198
|
+
def remove_argument(*names); end
|
2199
|
+
|
2200
|
+
# Removes a previous defined class option.
|
2201
|
+
#
|
2202
|
+
# ==== Parameters
|
2203
|
+
# names<Array>:: Class options to be removed
|
2204
|
+
#
|
2205
|
+
# ==== Examples
|
2206
|
+
#
|
2207
|
+
# remove_class_option :foo
|
2208
|
+
# remove_class_option :foo, :bar, :baz
|
2209
|
+
#
|
2210
|
+
# source://thor//lib/thor/base.rb#445
|
2211
|
+
def remove_class_option(*names); end
|
2212
|
+
|
2213
|
+
# Removes a given command from this Thor class. This is usually done if you
|
2214
|
+
# are inheriting from another class and don't want it to be available
|
2215
|
+
# anymore.
|
2216
|
+
#
|
2217
|
+
# By default it only remove the mapping to the command. But you can supply
|
2218
|
+
# :undefine => true to undefine the method from the class as well.
|
2219
|
+
#
|
2220
|
+
# ==== Parameters
|
2221
|
+
# name<Symbol|String>:: The name of the command to be removed
|
2222
|
+
# options<Hash>:: You can give :undefine => true if you want commands the method
|
2223
|
+
# to be undefined from the class as well.
|
2224
|
+
#
|
2225
|
+
# source://thor//lib/thor/base.rb#500
|
2226
|
+
def remove_command(*names); end
|
2227
|
+
|
2228
|
+
# Removes a given command from this Thor class. This is usually done if you
|
2229
|
+
# are inheriting from another class and don't want it to be available
|
2230
|
+
# anymore.
|
2231
|
+
#
|
2232
|
+
# By default it only remove the mapping to the command. But you can supply
|
2233
|
+
# :undefine => true to undefine the method from the class as well.
|
2234
|
+
#
|
2235
|
+
# ==== Parameters
|
2236
|
+
# name<Symbol|String>:: The name of the command to be removed
|
2237
|
+
# options<Hash>:: You can give :undefine => true if you want commands the method
|
2238
|
+
# to be undefined from the class as well.
|
2239
|
+
#
|
2240
|
+
# source://thor//lib/thor/base.rb#500
|
2241
|
+
def remove_task(*names); end
|
2242
|
+
|
2243
|
+
# Parses the command and options from the given args, instantiate the class
|
2244
|
+
# and invoke the command. This method is used when the arguments must be parsed
|
2245
|
+
# from an array. If you are inside Ruby and want to use a Thor class, you
|
2246
|
+
# can simply initialize it:
|
2247
|
+
#
|
2248
|
+
# script = MyScript.new(args, options, config)
|
2249
|
+
# script.invoke(:command, first_arg, second_arg, third_arg)
|
2250
|
+
#
|
2251
|
+
# source://thor//lib/thor/base.rb#582
|
2252
|
+
def start(given_args = T.unsafe(nil), config = T.unsafe(nil)); end
|
2253
|
+
|
2254
|
+
# If true, option parsing is suspended as soon as an unknown option or a
|
2255
|
+
# regular argument is encountered. All remaining arguments are passed to
|
2256
|
+
# the command as regular arguments.
|
2257
|
+
#
|
2258
|
+
# @return [Boolean]
|
2259
|
+
#
|
2260
|
+
# source://thor//lib/thor/base.rb#201
|
2261
|
+
def stop_on_unknown_option?(command_name); end
|
2262
|
+
|
2263
|
+
# source://thor//lib/thor/base.rb#218
|
2264
|
+
def strict_args_position; end
|
2265
|
+
|
2266
|
+
# If you want only strict string args (useful when cascading thor classes),
|
2267
|
+
# call strict_args_position! This is disabled by default to allow dynamic
|
2268
|
+
# invocations.
|
2269
|
+
#
|
2270
|
+
# source://thor//lib/thor/base.rb#214
|
2271
|
+
def strict_args_position!; end
|
2272
|
+
|
2273
|
+
# @return [Boolean]
|
2274
|
+
#
|
2275
|
+
# source://thor//lib/thor/base.rb#222
|
2276
|
+
def strict_args_position?(config); end
|
2277
|
+
|
2278
|
+
# Returns the commands for this Thor class.
|
2279
|
+
#
|
2280
|
+
# ==== Returns
|
2281
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
2282
|
+
# objects as values.
|
2283
|
+
#
|
2284
|
+
# source://thor//lib/thor/base.rb#471
|
2285
|
+
def tasks; end
|
2286
|
+
|
2287
|
+
protected
|
2288
|
+
|
2289
|
+
# SIGNATURE: Sets the baseclass. This is where the superclass lookup
|
2290
|
+
# finishes.
|
2291
|
+
#
|
2292
|
+
# source://thor//lib/thor/base.rb#777
|
2293
|
+
def baseclass; end
|
2294
|
+
|
2295
|
+
# The basename of the program invoking the thor class.
|
2296
|
+
#
|
2297
|
+
# source://thor//lib/thor/base.rb#771
|
2298
|
+
def basename; end
|
2299
|
+
|
2300
|
+
# Build an option and adds it to the given scope.
|
2301
|
+
#
|
2302
|
+
# ==== Parameters
|
2303
|
+
# name<Symbol>:: The name of the argument.
|
2304
|
+
# options<Hash>:: Described in both class_option and method_option.
|
2305
|
+
# scope<Hash>:: Options hash that is being built up
|
2306
|
+
#
|
2307
|
+
# source://thor//lib/thor/base.rb#688
|
2308
|
+
def build_option(name, options, scope); end
|
2309
|
+
|
2310
|
+
# Receives a hash of options, parse them and add to the scope. This is a
|
2311
|
+
# fast way to set a bunch of options:
|
2312
|
+
#
|
2313
|
+
# build_options :foo => true, :bar => :required, :baz => :string
|
2314
|
+
#
|
2315
|
+
# ==== Parameters
|
2316
|
+
# Hash[Symbol => Object]
|
2317
|
+
#
|
2318
|
+
# source://thor//lib/thor/base.rb#699
|
2319
|
+
def build_options(options, scope); end
|
2320
|
+
|
2321
|
+
# Get target(method_options or class_options) options
|
2322
|
+
# of before and after by block evaluation.
|
2323
|
+
#
|
2324
|
+
# source://thor//lib/thor/base.rb#808
|
2325
|
+
def built_option_names(target, opt = T.unsafe(nil), &block); end
|
2326
|
+
|
2327
|
+
# Prints the class options per group. If an option does not belong to
|
2328
|
+
# any group, it's printed as Class option.
|
2329
|
+
#
|
2330
|
+
# source://thor//lib/thor/base.rb#638
|
2331
|
+
def class_options_help(shell, groups = T.unsafe(nil)); end
|
2332
|
+
|
2333
|
+
# Get command scope member by name.
|
2334
|
+
#
|
2335
|
+
# source://thor//lib/thor/base.rb#816
|
2336
|
+
def command_scope_member(name, options = T.unsafe(nil)); end
|
2337
|
+
|
2338
|
+
# SIGNATURE: Creates a new command if valid_command? is true. This method is
|
2339
|
+
# called when a new method is added to the class.
|
2340
|
+
#
|
2341
|
+
# source://thor//lib/thor/base.rb#782
|
2342
|
+
def create_command(meth); end
|
2343
|
+
|
2344
|
+
# SIGNATURE: Creates a new command if valid_command? is true. This method is
|
2345
|
+
# called when a new method is added to the class.
|
2346
|
+
#
|
2347
|
+
# source://thor//lib/thor/base.rb#782
|
2348
|
+
def create_task(meth); end
|
2349
|
+
|
2350
|
+
# SIGNATURE: The hook invoked by start.
|
2351
|
+
#
|
2352
|
+
# @raise [NotImplementedError]
|
2353
|
+
#
|
2354
|
+
# source://thor//lib/thor/base.rb#792
|
2355
|
+
def dispatch(command, given_args, given_opts, config); end
|
2356
|
+
|
2357
|
+
# Finds a command with the given name. If the command belongs to the current
|
2358
|
+
# class, just return it, otherwise dup it and add the fresh copy to the
|
2359
|
+
# current command hash.
|
2360
|
+
#
|
2361
|
+
# source://thor//lib/thor/base.rb#708
|
2362
|
+
def find_and_refresh_command(name); end
|
2363
|
+
|
2364
|
+
# Finds a command with the given name. If the command belongs to the current
|
2365
|
+
# class, just return it, otherwise dup it and add the fresh copy to the
|
2366
|
+
# current command hash.
|
2367
|
+
#
|
2368
|
+
# source://thor//lib/thor/base.rb#708
|
2369
|
+
def find_and_refresh_task(name); end
|
2370
|
+
|
2371
|
+
# Retrieves a value from superclass. If it reaches the baseclass,
|
2372
|
+
# returns default.
|
2373
|
+
#
|
2374
|
+
# source://thor//lib/thor/base.rb#749
|
2375
|
+
def from_superclass(method, default = T.unsafe(nil)); end
|
2376
|
+
|
2377
|
+
# Every time someone inherits from a Thor class, register the klass
|
2378
|
+
# and file into baseclass.
|
2379
|
+
#
|
2380
|
+
# source://thor//lib/thor/base.rb#721
|
2381
|
+
def inherited(klass); end
|
2382
|
+
|
2383
|
+
# SIGNATURE: Defines behavior when the initialize method is added to the
|
2384
|
+
# class.
|
2385
|
+
#
|
2386
|
+
# source://thor//lib/thor/base.rb#788
|
2387
|
+
def initialize_added; end
|
2388
|
+
|
2389
|
+
# Raises an error if the word given is a Thor reserved word.
|
2390
|
+
#
|
2391
|
+
# @return [Boolean]
|
2392
|
+
#
|
2393
|
+
# source://thor//lib/thor/base.rb#677
|
2394
|
+
def is_thor_reserved_word?(word, type); end
|
2395
|
+
|
2396
|
+
# Fire this callback whenever a method is added. Added methods are
|
2397
|
+
# tracked as commands by invoking the create_command method.
|
2398
|
+
#
|
2399
|
+
# source://thor//lib/thor/base.rb#729
|
2400
|
+
def method_added(meth); end
|
2401
|
+
|
2402
|
+
# Receives a set of options and print them.
|
2403
|
+
#
|
2404
|
+
# source://thor//lib/thor/base.rb#656
|
2405
|
+
def print_options(shell, options, group_name = T.unsafe(nil)); end
|
2406
|
+
|
2407
|
+
# Register a relation of options for target(method_option/class_option)
|
2408
|
+
# by args and block.
|
2409
|
+
#
|
2410
|
+
# source://thor//lib/thor/base.rb#798
|
2411
|
+
def register_options_relation_for(target, relation, *args, &block); end
|
2412
|
+
end
|
2413
|
+
|
2414
|
+
# source://thor//lib/thor/command.rb#2
|
2415
|
+
class Thor::Command < ::Struct
|
2416
|
+
# @return [Command] a new instance of Command
|
2417
|
+
#
|
2418
|
+
# source://thor//lib/thor/command.rb#5
|
2419
|
+
def initialize(name, description, long_description, wrap_long_description, usage, options = T.unsafe(nil), options_relation = T.unsafe(nil)); end
|
2420
|
+
|
2421
|
+
# Returns the formatted usage by injecting given required arguments
|
2422
|
+
# and required options into the given usage.
|
2423
|
+
#
|
2424
|
+
# source://thor//lib/thor/command.rb#42
|
2425
|
+
def formatted_usage(klass, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
2426
|
+
|
2427
|
+
# @return [Boolean]
|
2428
|
+
#
|
2429
|
+
# source://thor//lib/thor/command.rb#15
|
2430
|
+
def hidden?; end
|
2431
|
+
|
2432
|
+
# source://thor//lib/thor/command.rb#70
|
2433
|
+
def method_at_least_one_option_names; end
|
2434
|
+
|
2435
|
+
# source://thor//lib/thor/command.rb#66
|
2436
|
+
def method_exclusive_option_names; end
|
2437
|
+
|
2438
|
+
# By default, a command invokes a method in the thor class. You can change this
|
2439
|
+
# implementation to create custom commands.
|
2440
|
+
#
|
2441
|
+
# source://thor//lib/thor/command.rb#21
|
2442
|
+
def run(instance, args = T.unsafe(nil)); end
|
2443
|
+
|
2444
|
+
protected
|
2445
|
+
|
2446
|
+
# @return [Boolean]
|
2447
|
+
#
|
2448
|
+
# source://thor//lib/thor/command.rb#114
|
2449
|
+
def handle_argument_error?(instance, error, caller); end
|
2450
|
+
|
2451
|
+
# @return [Boolean]
|
2452
|
+
#
|
2453
|
+
# source://thor//lib/thor/command.rb#121
|
2454
|
+
def handle_no_method_error?(instance, error, caller); end
|
2455
|
+
|
2456
|
+
# @return [Boolean]
|
2457
|
+
#
|
2458
|
+
# source://thor//lib/thor/command.rb#104
|
2459
|
+
def local_method?(instance, name); end
|
2460
|
+
|
2461
|
+
# @return [Boolean]
|
2462
|
+
#
|
2463
|
+
# source://thor//lib/thor/command.rb#87
|
2464
|
+
def not_debugging?(instance); end
|
2465
|
+
|
2466
|
+
# @return [Boolean]
|
2467
|
+
#
|
2468
|
+
# source://thor//lib/thor/command.rb#100
|
2469
|
+
def private_method?(instance); end
|
2470
|
+
|
2471
|
+
# Given a target, checks if this class name is a public method.
|
2472
|
+
#
|
2473
|
+
# @return [Boolean]
|
2474
|
+
#
|
2475
|
+
# source://thor//lib/thor/command.rb#96
|
2476
|
+
def public_method?(instance); end
|
2477
|
+
|
2478
|
+
# Add usage with required arguments
|
2479
|
+
#
|
2480
|
+
# source://thor//lib/thor/command.rb#77
|
2481
|
+
def required_arguments_for(klass, usage); end
|
2482
|
+
|
2483
|
+
# source://thor//lib/thor/command.rb#91
|
2484
|
+
def required_options; end
|
2485
|
+
|
2486
|
+
# source://thor//lib/thor/command.rb#109
|
2487
|
+
def sans_backtrace(backtrace, caller); end
|
2488
|
+
|
2489
|
+
private
|
2490
|
+
|
2491
|
+
# source://thor//lib/thor/command.rb#9
|
2492
|
+
def initialize_copy(other); end
|
2493
|
+
end
|
2494
|
+
|
2495
|
+
# source://thor//lib/thor/command.rb#3
|
2496
|
+
Thor::Command::FILE_REGEXP = T.let(T.unsafe(nil), Regexp)
|
2497
|
+
|
2498
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#2
|
2499
|
+
module Thor::CoreExt; end
|
2500
|
+
|
2501
|
+
# A hash with indifferent access and magic predicates.
|
2502
|
+
#
|
2503
|
+
# hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
|
2504
|
+
#
|
2505
|
+
# hash[:foo] #=> 'bar'
|
2506
|
+
# hash['foo'] #=> 'bar'
|
2507
|
+
# hash.foo? #=> true
|
2508
|
+
#
|
2509
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#11
|
2510
|
+
class Thor::CoreExt::HashWithIndifferentAccess < ::Hash
|
2511
|
+
# @return [HashWithIndifferentAccess] a new instance of HashWithIndifferentAccess
|
2512
|
+
#
|
2513
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#12
|
2514
|
+
def initialize(hash = T.unsafe(nil)); end
|
2515
|
+
|
2516
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#19
|
2517
|
+
def [](key); end
|
2518
|
+
|
2519
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#23
|
2520
|
+
def []=(key, value); end
|
2521
|
+
|
2522
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#27
|
2523
|
+
def delete(key); end
|
2524
|
+
|
2525
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#31
|
2526
|
+
def except(*keys); end
|
2527
|
+
|
2528
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#37
|
2529
|
+
def fetch(key, *args); end
|
2530
|
+
|
2531
|
+
# @return [Boolean]
|
2532
|
+
#
|
2533
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#45
|
2534
|
+
def key?(key); end
|
2535
|
+
|
2536
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#53
|
2537
|
+
def merge(other); end
|
2538
|
+
|
2539
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#57
|
2540
|
+
def merge!(other); end
|
2541
|
+
|
2542
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#72
|
2543
|
+
def replace(other_hash); end
|
2544
|
+
|
2545
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#64
|
2546
|
+
def reverse_merge(other); end
|
2547
|
+
|
2548
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#68
|
2549
|
+
def reverse_merge!(other_hash); end
|
2550
|
+
|
2551
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#41
|
2552
|
+
def slice(*keys); end
|
2553
|
+
|
2554
|
+
# Convert to a Hash with String keys.
|
2555
|
+
#
|
2556
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#77
|
2557
|
+
def to_hash; end
|
2558
|
+
|
2559
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#49
|
2560
|
+
def values_at(*indices); end
|
2561
|
+
|
2562
|
+
protected
|
2563
|
+
|
2564
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#83
|
2565
|
+
def convert_key(key); end
|
2566
|
+
|
2567
|
+
# Magic predicates. For instance:
|
2568
|
+
#
|
2569
|
+
# options.force? # => !!options['force']
|
2570
|
+
# options.shebang # => "/usr/lib/local/ruby"
|
2571
|
+
# options.test_framework?(:rspec) # => options[:test_framework] == :rspec
|
2572
|
+
#
|
2573
|
+
# source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#93
|
2574
|
+
def method_missing(method, *args); end
|
2575
|
+
end
|
2576
|
+
|
2577
|
+
# source://thor//lib/thor/error.rb#3
|
2578
|
+
module Thor::Correctable
|
2579
|
+
# source://thor//lib/thor/error.rb#8
|
2580
|
+
def corrections; end
|
2581
|
+
|
2582
|
+
# source://thor//lib/thor/error.rb#4
|
2583
|
+
def to_s; end
|
2584
|
+
end
|
2585
|
+
|
2586
|
+
# A dynamic command that handles method missing scenarios.
|
2587
|
+
#
|
2588
|
+
# source://thor//lib/thor/command.rb#137
|
2589
|
+
class Thor::DynamicCommand < ::Thor::Command
|
2590
|
+
# @return [DynamicCommand] a new instance of DynamicCommand
|
2591
|
+
#
|
2592
|
+
# source://thor//lib/thor/command.rb#138
|
2593
|
+
def initialize(name, options = T.unsafe(nil)); end
|
2594
|
+
|
2595
|
+
# source://thor//lib/thor/command.rb#142
|
2596
|
+
def run(instance, args = T.unsafe(nil)); end
|
2597
|
+
end
|
2598
|
+
|
2599
|
+
# source://thor//lib/thor/command.rb#150
|
2600
|
+
Thor::DynamicTask = Thor::DynamicCommand
|
2601
|
+
|
2602
|
+
# Thor::Error is raised when it's caused by wrong usage of thor classes. Those
|
2603
|
+
# errors have their backtrace suppressed and are nicely shown to the user.
|
2604
|
+
#
|
2605
|
+
# Errors that are caused by the developer, like declaring a method which
|
2606
|
+
# overwrites a thor keyword, SHOULD NOT raise a Thor::Error. This way, we
|
2607
|
+
# ensure that developer errors are shown with full backtrace.
|
2608
|
+
#
|
2609
|
+
# source://thor//lib/thor/error.rb#20
|
2610
|
+
class Thor::Error < ::StandardError; end
|
2611
|
+
|
2612
|
+
# source://thor//lib/thor/error.rb#101
|
2613
|
+
class Thor::ExclusiveArgumentError < ::Thor::InvocationError; end
|
2614
|
+
|
2615
|
+
# Thor has a special class called Thor::Group. The main difference to Thor class
|
2616
|
+
# is that it invokes all commands at once. It also include some methods that allows
|
2617
|
+
# invocations to be done at the class method, which are not available to Thor
|
2618
|
+
# commands.
|
2619
|
+
#
|
2620
|
+
# source://thor//lib/thor/group.rb#7
|
2621
|
+
class Thor::Group
|
2622
|
+
include ::Thor::Base
|
2623
|
+
include ::Thor::Invocation
|
2624
|
+
include ::Thor::Shell
|
2625
|
+
extend ::Thor::Base::ClassMethods
|
2626
|
+
extend ::Thor::Invocation::ClassMethods
|
2627
|
+
|
2628
|
+
protected
|
2629
|
+
|
2630
|
+
# Shortcut to invoke with padding and block handling. Use internally by
|
2631
|
+
# invoke and invoke_from_option class methods.
|
2632
|
+
#
|
2633
|
+
# source://thor//lib/thor/group.rb#265
|
2634
|
+
def _invoke_for_class_method(klass, command = T.unsafe(nil), *args, &block); end
|
2635
|
+
|
2636
|
+
class << self
|
2637
|
+
# Overwrite class options help to allow invoked generators options to be
|
2638
|
+
# shown recursively when invoking a generator.
|
2639
|
+
#
|
2640
|
+
# source://thor//lib/thor/group.rb#161
|
2641
|
+
def class_options_help(shell, groups = T.unsafe(nil)); end
|
2642
|
+
|
2643
|
+
# The description for this Thor::Group. If none is provided, but a source root
|
2644
|
+
# exists, tries to find the USAGE one folder above it, otherwise searches
|
2645
|
+
# in the superclass.
|
2646
|
+
#
|
2647
|
+
# ==== Parameters
|
2648
|
+
# description<String>:: The description for this Thor::Group.
|
2649
|
+
#
|
2650
|
+
# source://thor//lib/thor/group.rb#16
|
2651
|
+
def desc(description = T.unsafe(nil)); end
|
2652
|
+
|
2653
|
+
# Get invocations array and merge options from invocations. Those
|
2654
|
+
# options are added to group_options hash. Options that already exists
|
2655
|
+
# in base_options are not added twice.
|
2656
|
+
#
|
2657
|
+
# source://thor//lib/thor/group.rb#172
|
2658
|
+
def get_options_from_invocations(group_options, base_options); end
|
2659
|
+
|
2660
|
+
# @raise [error]
|
2661
|
+
#
|
2662
|
+
# source://thor//lib/thor/group.rb#207
|
2663
|
+
def handle_argument_error(command, error, _args, arity); end
|
2664
|
+
|
2665
|
+
# Prints help information.
|
2666
|
+
#
|
2667
|
+
# ==== Options
|
2668
|
+
# short:: When true, shows only usage.
|
2669
|
+
#
|
2670
|
+
# source://thor//lib/thor/group.rb#29
|
2671
|
+
def help(shell); end
|
2672
|
+
|
2673
|
+
# Stores invocation blocks used on invoke_from_option.
|
2674
|
+
#
|
2675
|
+
# source://thor//lib/thor/group.rb#45
|
2676
|
+
def invocation_blocks; end
|
2677
|
+
|
2678
|
+
# Stores invocations for this class merging with superclass values.
|
2679
|
+
#
|
2680
|
+
# source://thor//lib/thor/group.rb#39
|
2681
|
+
def invocations; end
|
2682
|
+
|
2683
|
+
# Invoke the given namespace or class given. It adds an instance
|
2684
|
+
# method that will invoke the klass and command. You can give a block to
|
2685
|
+
# configure how it will be invoked.
|
2686
|
+
#
|
2687
|
+
# The namespace/class given will have its options showed on the help
|
2688
|
+
# usage. Check invoke_from_option for more information.
|
2689
|
+
#
|
2690
|
+
# source://thor//lib/thor/group.rb#56
|
2691
|
+
def invoke(*names, &block); end
|
2692
|
+
|
2693
|
+
# Invoke a thor class based on the value supplied by the user to the
|
2694
|
+
# given option named "name". A class option must be created before this
|
2695
|
+
# method is invoked for each name given.
|
2696
|
+
#
|
2697
|
+
# ==== Examples
|
2698
|
+
#
|
2699
|
+
# class GemGenerator < Thor::Group
|
2700
|
+
# class_option :test_framework, :type => :string
|
2701
|
+
# invoke_from_option :test_framework
|
2702
|
+
# end
|
2703
|
+
#
|
2704
|
+
# ==== Boolean options
|
2705
|
+
#
|
2706
|
+
# In some cases, you want to invoke a thor class if some option is true or
|
2707
|
+
# false. This is automatically handled by invoke_from_option. Then the
|
2708
|
+
# option name is used to invoke the generator.
|
2709
|
+
#
|
2710
|
+
# ==== Preparing for invocation
|
2711
|
+
#
|
2712
|
+
# In some cases you want to customize how a specified hook is going to be
|
2713
|
+
# invoked. You can do that by overwriting the class method
|
2714
|
+
# prepare_for_invocation. The class method must necessarily return a klass
|
2715
|
+
# and an optional command.
|
2716
|
+
#
|
2717
|
+
# ==== Custom invocations
|
2718
|
+
#
|
2719
|
+
# You can also supply a block to customize how the option is going to be
|
2720
|
+
# invoked. The block receives two parameters, an instance of the current
|
2721
|
+
# class and the klass to be invoked.
|
2722
|
+
#
|
2723
|
+
# source://thor//lib/thor/group.rb#110
|
2724
|
+
def invoke_from_option(*names, &block); end
|
2725
|
+
|
2726
|
+
# Returns commands ready to be printed.
|
2727
|
+
#
|
2728
|
+
# source://thor//lib/thor/group.rb#199
|
2729
|
+
def printable_commands(*_arg0); end
|
2730
|
+
|
2731
|
+
# Returns commands ready to be printed.
|
2732
|
+
#
|
2733
|
+
# source://thor//lib/thor/group.rb#199
|
2734
|
+
def printable_tasks(*_arg0); end
|
2735
|
+
|
2736
|
+
# Remove a previously added invocation.
|
2737
|
+
#
|
2738
|
+
# ==== Examples
|
2739
|
+
#
|
2740
|
+
# remove_invocation :test_framework
|
2741
|
+
#
|
2742
|
+
# source://thor//lib/thor/group.rb#149
|
2743
|
+
def remove_invocation(*names); end
|
2744
|
+
|
2745
|
+
protected
|
2746
|
+
|
2747
|
+
# The banner for this class. You can customize it if you are invoking the
|
2748
|
+
# thor class by another ways which is not the Thor::Runner.
|
2749
|
+
#
|
2750
|
+
# source://thor//lib/thor/group.rb#238
|
2751
|
+
def banner; end
|
2752
|
+
|
2753
|
+
# source://thor//lib/thor/group.rb#248
|
2754
|
+
def baseclass; end
|
2755
|
+
|
2756
|
+
# source://thor//lib/thor/group.rb#252
|
2757
|
+
def create_command(meth); end
|
2758
|
+
|
2759
|
+
# source://thor//lib/thor/group.rb#252
|
2760
|
+
def create_task(meth); end
|
2761
|
+
|
2762
|
+
# The method responsible for dispatching given the args.
|
2763
|
+
#
|
2764
|
+
# @yield [instance]
|
2765
|
+
#
|
2766
|
+
# source://thor//lib/thor/group.rb#217
|
2767
|
+
def dispatch(command, given_args, given_opts, config); end
|
2768
|
+
|
2769
|
+
# Represents the whole class as a command.
|
2770
|
+
#
|
2771
|
+
# source://thor//lib/thor/group.rb#243
|
2772
|
+
def self_command; end
|
2773
|
+
|
2774
|
+
# Represents the whole class as a command.
|
2775
|
+
#
|
2776
|
+
# source://thor//lib/thor/group.rb#243
|
2777
|
+
def self_task; end
|
2778
|
+
end
|
2779
|
+
end
|
2780
|
+
|
2781
|
+
# Shortcuts for help.
|
2782
|
+
#
|
2783
|
+
# source://thor//lib/thor/base.rb#17
|
2784
|
+
Thor::HELP_MAPPINGS = T.let(T.unsafe(nil), Array)
|
2785
|
+
|
2786
|
+
# A command that is hidden in help messages but still invocable.
|
2787
|
+
#
|
2788
|
+
# source://thor//lib/thor/command.rb#129
|
2789
|
+
class Thor::HiddenCommand < ::Thor::Command
|
2790
|
+
# @return [Boolean]
|
2791
|
+
#
|
2792
|
+
# source://thor//lib/thor/command.rb#130
|
2793
|
+
def hidden?; end
|
2794
|
+
end
|
2795
|
+
|
2796
|
+
# source://thor//lib/thor/command.rb#134
|
2797
|
+
Thor::HiddenTask = Thor::HiddenCommand
|
2798
|
+
|
2799
|
+
# source://thor//lib/thor/invocation.rb#2
|
2800
|
+
module Thor::Invocation
|
2801
|
+
mixes_in_class_methods ::Thor::Invocation::ClassMethods
|
2802
|
+
|
2803
|
+
# Make initializer aware of invocations and the initialization args.
|
2804
|
+
#
|
2805
|
+
# source://thor//lib/thor/invocation.rb#23
|
2806
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
2807
|
+
|
2808
|
+
# Make the current command chain accessible with in a Thor-(sub)command
|
2809
|
+
#
|
2810
|
+
# source://thor//lib/thor/invocation.rb#30
|
2811
|
+
def current_command_chain; end
|
2812
|
+
|
2813
|
+
# Receives a name and invokes it. The name can be a string (either "command" or
|
2814
|
+
# "namespace:command"), a Thor::Command, a Class or a Thor instance. If the
|
2815
|
+
# command cannot be guessed by name, it can also be supplied as second argument.
|
2816
|
+
#
|
2817
|
+
# You can also supply the arguments, options and configuration values for
|
2818
|
+
# the command to be invoked, if none is given, the same values used to
|
2819
|
+
# initialize the invoker are used to initialize the invoked.
|
2820
|
+
#
|
2821
|
+
# When no name is given, it will invoke the default command of the current class.
|
2822
|
+
#
|
2823
|
+
# ==== Examples
|
2824
|
+
#
|
2825
|
+
# class A < Thor
|
2826
|
+
# def foo
|
2827
|
+
# invoke :bar
|
2828
|
+
# invoke "b:hello", ["Erik"]
|
2829
|
+
# end
|
2830
|
+
#
|
2831
|
+
# def bar
|
2832
|
+
# invoke "b:hello", ["Erik"]
|
2833
|
+
# end
|
2834
|
+
# end
|
2835
|
+
#
|
2836
|
+
# class B < Thor
|
2837
|
+
# def hello(name)
|
2838
|
+
# puts "hello #{name}"
|
2839
|
+
# end
|
2840
|
+
# end
|
2841
|
+
#
|
2842
|
+
# You can notice that the method "foo" above invokes two commands: "bar",
|
2843
|
+
# which belongs to the same class and "hello" which belongs to the class B.
|
2844
|
+
#
|
2845
|
+
# By using an invocation system you ensure that a command is invoked only once.
|
2846
|
+
# In the example above, invoking "foo" will invoke "b:hello" just once, even
|
2847
|
+
# if it's invoked later by "bar" method.
|
2848
|
+
#
|
2849
|
+
# When class A invokes class B, all arguments used on A initialization are
|
2850
|
+
# supplied to B. This allows lazy parse of options. Let's suppose you have
|
2851
|
+
# some rspec commands:
|
2852
|
+
#
|
2853
|
+
# class Rspec < Thor::Group
|
2854
|
+
# class_option :mock_framework, :type => :string, :default => :rr
|
2855
|
+
#
|
2856
|
+
# def invoke_mock_framework
|
2857
|
+
# invoke "rspec:#{options[:mock_framework]}"
|
2858
|
+
# end
|
2859
|
+
# end
|
2860
|
+
#
|
2861
|
+
# As you noticed, it invokes the given mock framework, which might have its
|
2862
|
+
# own options:
|
2863
|
+
#
|
2864
|
+
# class Rspec::RR < Thor::Group
|
2865
|
+
# class_option :style, :type => :string, :default => :mock
|
2866
|
+
# end
|
2867
|
+
#
|
2868
|
+
# Since it's not rspec concern to parse mock framework options, when RR
|
2869
|
+
# is invoked all options are parsed again, so RR can extract only the options
|
2870
|
+
# that it's going to use.
|
2871
|
+
#
|
2872
|
+
# If you want Rspec::RR to be initialized with its own set of options, you
|
2873
|
+
# have to do that explicitly:
|
2874
|
+
#
|
2875
|
+
# invoke "rspec:rr", [], :style => :foo
|
2876
|
+
#
|
2877
|
+
# Besides giving an instance, you can also give a class to invoke:
|
2878
|
+
#
|
2879
|
+
# invoke Rspec::RR, [], :style => :foo
|
2880
|
+
#
|
2881
|
+
# source://thor//lib/thor/invocation.rb#102
|
2882
|
+
def invoke(name = T.unsafe(nil), *args); end
|
2883
|
+
|
2884
|
+
# Invoke all commands for the current instance.
|
2885
|
+
#
|
2886
|
+
# source://thor//lib/thor/invocation.rb#133
|
2887
|
+
def invoke_all; end
|
2888
|
+
|
2889
|
+
# Invoke the given command if the given args.
|
2890
|
+
#
|
2891
|
+
# source://thor//lib/thor/invocation.rb#122
|
2892
|
+
def invoke_command(command, *args); end
|
2893
|
+
|
2894
|
+
# Invoke the given command if the given args.
|
2895
|
+
#
|
2896
|
+
# source://thor//lib/thor/invocation.rb#122
|
2897
|
+
def invoke_task(command, *args); end
|
2898
|
+
|
2899
|
+
# Invokes using shell padding.
|
2900
|
+
#
|
2901
|
+
# source://thor//lib/thor/invocation.rb#138
|
2902
|
+
def invoke_with_padding(*args); end
|
2903
|
+
|
2904
|
+
protected
|
2905
|
+
|
2906
|
+
# Initialize klass using values stored in the @_initializer.
|
2907
|
+
#
|
2908
|
+
# source://thor//lib/thor/invocation.rb#166
|
2909
|
+
def _parse_initialization_options(args, opts, config); end
|
2910
|
+
|
2911
|
+
# This method simply retrieves the class and command to be invoked.
|
2912
|
+
# If the name is nil or the given name is a command in the current class,
|
2913
|
+
# use the given name and return self as class. Otherwise, call
|
2914
|
+
# prepare_for_invocation in the current class.
|
2915
|
+
#
|
2916
|
+
# source://thor//lib/thor/invocation.rb#153
|
2917
|
+
def _retrieve_class_and_command(name, sent_command = T.unsafe(nil)); end
|
2918
|
+
|
2919
|
+
# This method simply retrieves the class and command to be invoked.
|
2920
|
+
# If the name is nil or the given name is a command in the current class,
|
2921
|
+
# use the given name and return self as class. Otherwise, call
|
2922
|
+
# prepare_for_invocation in the current class.
|
2923
|
+
#
|
2924
|
+
# source://thor//lib/thor/invocation.rb#153
|
2925
|
+
def _retrieve_class_and_task(name, sent_command = T.unsafe(nil)); end
|
2926
|
+
|
2927
|
+
# Configuration values that are shared between invocations.
|
2928
|
+
#
|
2929
|
+
# source://thor//lib/thor/invocation.rb#145
|
2930
|
+
def _shared_configuration; end
|
2931
|
+
|
2932
|
+
class << self
|
2933
|
+
# source://thor//lib/thor/invocation.rb#3
|
2934
|
+
def included(base); end
|
2935
|
+
end
|
2936
|
+
end
|
2937
|
+
|
2938
|
+
# source://thor//lib/thor/invocation.rb#8
|
2939
|
+
module Thor::Invocation::ClassMethods
|
2940
|
+
# This method is responsible for receiving a name and find the proper
|
2941
|
+
# class and command for it. The key is an optional parameter which is
|
2942
|
+
# available only in class methods invocations (i.e. in Thor::Group).
|
2943
|
+
#
|
2944
|
+
# source://thor//lib/thor/invocation.rb#12
|
2945
|
+
def prepare_for_invocation(key, name); end
|
2946
|
+
end
|
2947
|
+
|
2948
|
+
# Raised when a command was found, but not invoked properly.
|
2949
|
+
#
|
2950
|
+
# source://thor//lib/thor/error.rb#62
|
2951
|
+
class Thor::InvocationError < ::Thor::Error; end
|
2952
|
+
|
2953
|
+
# source://thor//lib/thor/line_editor/basic.rb#2
|
2954
|
+
module Thor::LineEditor
|
2955
|
+
class << self
|
2956
|
+
# source://thor//lib/thor/line_editor.rb#10
|
2957
|
+
def best_available; end
|
2958
|
+
|
2959
|
+
# source://thor//lib/thor/line_editor.rb#6
|
2960
|
+
def readline(prompt, options = T.unsafe(nil)); end
|
2961
|
+
end
|
2962
|
+
end
|
2963
|
+
|
2964
|
+
# source://thor//lib/thor/line_editor/basic.rb#3
|
2965
|
+
class Thor::LineEditor::Basic
|
2966
|
+
# @return [Basic] a new instance of Basic
|
2967
|
+
#
|
2968
|
+
# source://thor//lib/thor/line_editor/basic.rb#10
|
2969
|
+
def initialize(prompt, options); end
|
2970
|
+
|
2971
|
+
# Returns the value of attribute options.
|
2972
|
+
#
|
2973
|
+
# source://thor//lib/thor/line_editor/basic.rb#4
|
2974
|
+
def options; end
|
2975
|
+
|
2976
|
+
# Returns the value of attribute prompt.
|
2977
|
+
#
|
2978
|
+
# source://thor//lib/thor/line_editor/basic.rb#4
|
2979
|
+
def prompt; end
|
2980
|
+
|
2981
|
+
# source://thor//lib/thor/line_editor/basic.rb#15
|
2982
|
+
def readline; end
|
2983
|
+
|
2984
|
+
private
|
2985
|
+
|
2986
|
+
# @return [Boolean]
|
2987
|
+
#
|
2988
|
+
# source://thor//lib/thor/line_editor/basic.rb#32
|
2989
|
+
def echo?; end
|
2990
|
+
|
2991
|
+
# source://thor//lib/thor/line_editor/basic.rb#22
|
2992
|
+
def get_input; end
|
2993
|
+
|
2994
|
+
class << self
|
2995
|
+
# @return [Boolean]
|
2996
|
+
#
|
2997
|
+
# source://thor//lib/thor/line_editor/basic.rb#6
|
2998
|
+
def available?; end
|
2999
|
+
end
|
3000
|
+
end
|
3001
|
+
|
3002
|
+
# source://thor//lib/thor/line_editor/readline.rb#3
|
3003
|
+
class Thor::LineEditor::Readline < ::Thor::LineEditor::Basic
|
3004
|
+
# source://thor//lib/thor/line_editor/readline.rb#13
|
3005
|
+
def readline; end
|
3006
|
+
|
3007
|
+
private
|
3008
|
+
|
3009
|
+
# @return [Boolean]
|
3010
|
+
#
|
3011
|
+
# source://thor//lib/thor/line_editor/readline.rb#28
|
3012
|
+
def add_to_history?; end
|
3013
|
+
|
3014
|
+
# source://thor//lib/thor/line_editor/readline.rb#42
|
3015
|
+
def completion_options; end
|
3016
|
+
|
3017
|
+
# source://thor//lib/thor/line_editor/readline.rb#32
|
3018
|
+
def completion_proc; end
|
3019
|
+
|
3020
|
+
# @return [Boolean]
|
3021
|
+
#
|
3022
|
+
# source://thor//lib/thor/line_editor/readline.rb#46
|
3023
|
+
def use_path_completion?; end
|
3024
|
+
|
3025
|
+
class << self
|
3026
|
+
# @return [Boolean]
|
3027
|
+
#
|
3028
|
+
# source://thor//lib/thor/line_editor/readline.rb#4
|
3029
|
+
def available?; end
|
3030
|
+
end
|
3031
|
+
end
|
3032
|
+
|
3033
|
+
# source://thor//lib/thor/line_editor/readline.rb#50
|
3034
|
+
class Thor::LineEditor::Readline::PathCompletion
|
3035
|
+
# @return [PathCompletion] a new instance of PathCompletion
|
3036
|
+
#
|
3037
|
+
# source://thor//lib/thor/line_editor/readline.rb#54
|
3038
|
+
def initialize(text); end
|
3039
|
+
|
3040
|
+
# source://thor//lib/thor/line_editor/readline.rb#58
|
3041
|
+
def matches; end
|
3042
|
+
|
3043
|
+
private
|
3044
|
+
|
3045
|
+
# source://thor//lib/thor/line_editor/readline.rb#68
|
3046
|
+
def absolute_matches; end
|
3047
|
+
|
3048
|
+
# source://thor//lib/thor/line_editor/readline.rb#82
|
3049
|
+
def base_path; end
|
3050
|
+
|
3051
|
+
# source://thor//lib/thor/line_editor/readline.rb#78
|
3052
|
+
def glob_pattern; end
|
3053
|
+
|
3054
|
+
# source://thor//lib/thor/line_editor/readline.rb#64
|
3055
|
+
def relative_matches; end
|
3056
|
+
|
3057
|
+
# Returns the value of attribute text.
|
3058
|
+
#
|
3059
|
+
# source://thor//lib/thor/line_editor/readline.rb#51
|
3060
|
+
def text; end
|
3061
|
+
end
|
3062
|
+
|
3063
|
+
# source://thor//lib/thor/error.rb#98
|
3064
|
+
class Thor::MalformattedArgumentError < ::Thor::InvocationError; end
|
3065
|
+
|
3066
|
+
# source://thor//lib/thor/nested_context.rb#2
|
3067
|
+
class Thor::NestedContext
|
3068
|
+
# @return [NestedContext] a new instance of NestedContext
|
3069
|
+
#
|
3070
|
+
# source://thor//lib/thor/nested_context.rb#3
|
3071
|
+
def initialize; end
|
3072
|
+
|
3073
|
+
# source://thor//lib/thor/nested_context.rb#7
|
3074
|
+
def enter; end
|
3075
|
+
|
3076
|
+
# @return [Boolean]
|
3077
|
+
#
|
3078
|
+
# source://thor//lib/thor/nested_context.rb#15
|
3079
|
+
def entered?; end
|
3080
|
+
|
3081
|
+
private
|
3082
|
+
|
3083
|
+
# source://thor//lib/thor/nested_context.rb#25
|
3084
|
+
def pop; end
|
3085
|
+
|
3086
|
+
# source://thor//lib/thor/nested_context.rb#21
|
3087
|
+
def push; end
|
3088
|
+
end
|
3089
|
+
|
3090
|
+
# source://thor//lib/thor/parser/option.rb#2
|
3091
|
+
class Thor::Option < ::Thor::Argument
|
3092
|
+
# @return [Option] a new instance of Option
|
3093
|
+
#
|
3094
|
+
# source://thor//lib/thor/parser/option.rb#7
|
3095
|
+
def initialize(name, options = T.unsafe(nil)); end
|
3096
|
+
|
3097
|
+
# Returns the value of attribute aliases.
|
3098
|
+
#
|
3099
|
+
# source://thor//lib/thor/parser/option.rb#3
|
3100
|
+
def aliases; end
|
3101
|
+
|
3102
|
+
# source://thor//lib/thor/parser/option.rb#99
|
3103
|
+
def aliases_for_usage; end
|
3104
|
+
|
3105
|
+
# source://thor//lib/thor/parser/option.rb#118
|
3106
|
+
def array?; end
|
3107
|
+
|
3108
|
+
# source://thor//lib/thor/parser/option.rb#118
|
3109
|
+
def boolean?; end
|
3110
|
+
|
3111
|
+
# Returns the value of attribute group.
|
3112
|
+
#
|
3113
|
+
# source://thor//lib/thor/parser/option.rb#3
|
3114
|
+
def group; end
|
3115
|
+
|
3116
|
+
# source://thor//lib/thor/parser/option.rb#118
|
3117
|
+
def hash?; end
|
3118
|
+
|
3119
|
+
# Returns the value of attribute hide.
|
3120
|
+
#
|
3121
|
+
# source://thor//lib/thor/parser/option.rb#3
|
3122
|
+
def hide; end
|
3123
|
+
|
3124
|
+
# source://thor//lib/thor/parser/option.rb#79
|
3125
|
+
def human_name; end
|
3126
|
+
|
3127
|
+
# Returns the value of attribute lazy_default.
|
3128
|
+
#
|
3129
|
+
# source://thor//lib/thor/parser/option.rb#3
|
3130
|
+
def lazy_default; end
|
3131
|
+
|
3132
|
+
# source://thor//lib/thor/parser/option.rb#118
|
3133
|
+
def numeric?; end
|
3134
|
+
|
3135
|
+
# Returns the value of attribute repeatable.
|
3136
|
+
#
|
3137
|
+
# source://thor//lib/thor/parser/option.rb#3
|
3138
|
+
def repeatable; end
|
3139
|
+
|
3140
|
+
# @return [Boolean]
|
3141
|
+
#
|
3142
|
+
# source://thor//lib/thor/parser/option.rb#107
|
3143
|
+
def show_default?; end
|
3144
|
+
|
3145
|
+
# source://thor//lib/thor/parser/option.rb#118
|
3146
|
+
def string?; end
|
3147
|
+
|
3148
|
+
# source://thor//lib/thor/parser/option.rb#75
|
3149
|
+
def switch_name; end
|
3150
|
+
|
3151
|
+
# source://thor//lib/thor/parser/option.rb#83
|
3152
|
+
def usage(padding = T.unsafe(nil)); end
|
3153
|
+
|
3154
|
+
protected
|
3155
|
+
|
3156
|
+
# source://thor//lib/thor/parser/option.rb#168
|
3157
|
+
def dasherize(str); end
|
3158
|
+
|
3159
|
+
# @return [Boolean]
|
3160
|
+
#
|
3161
|
+
# source://thor//lib/thor/parser/option.rb#160
|
3162
|
+
def dasherized?; end
|
3163
|
+
|
3164
|
+
# source://thor//lib/thor/parser/option.rb#164
|
3165
|
+
def undasherize(str); end
|
3166
|
+
|
3167
|
+
# @raise [ArgumentError]
|
3168
|
+
#
|
3169
|
+
# source://thor//lib/thor/parser/option.rb#126
|
3170
|
+
def validate!; end
|
3171
|
+
|
3172
|
+
# source://thor//lib/thor/parser/option.rb#131
|
3173
|
+
def validate_default_type!; end
|
3174
|
+
|
3175
|
+
private
|
3176
|
+
|
3177
|
+
# source://thor//lib/thor/parser/option.rb#174
|
3178
|
+
def normalize_aliases(aliases); end
|
3179
|
+
|
3180
|
+
class << self
|
3181
|
+
# This parse quick options given as method_options. It makes several
|
3182
|
+
# assumptions, but you can be more specific using the option method.
|
3183
|
+
#
|
3184
|
+
# parse :foo => "bar"
|
3185
|
+
# #=> Option foo with default value bar
|
3186
|
+
#
|
3187
|
+
# parse [:foo, :baz] => "bar"
|
3188
|
+
# #=> Option foo with default value bar and alias :baz
|
3189
|
+
#
|
3190
|
+
# parse :foo => :required
|
3191
|
+
# #=> Required option foo without default value
|
3192
|
+
#
|
3193
|
+
# parse :foo => 2
|
3194
|
+
# #=> Option foo with default value 2 and type numeric
|
3195
|
+
#
|
3196
|
+
# parse :foo => :numeric
|
3197
|
+
# #=> Option foo without default value and type numeric
|
3198
|
+
#
|
3199
|
+
# parse :foo => true
|
3200
|
+
# #=> Option foo with default value true and type boolean
|
3201
|
+
#
|
3202
|
+
# The valid types are :boolean, :numeric, :hash, :array and :string. If none
|
3203
|
+
# is given a default type is assumed. This default type accepts arguments as
|
3204
|
+
# string (--foo=value) or booleans (just --foo).
|
3205
|
+
#
|
3206
|
+
# By default all options are optional, unless :required is given.
|
3207
|
+
#
|
3208
|
+
# source://thor//lib/thor/parser/option.rb#45
|
3209
|
+
def parse(key, value); end
|
3210
|
+
end
|
3211
|
+
end
|
3212
|
+
|
3213
|
+
# source://thor//lib/thor/parser/option.rb#5
|
3214
|
+
Thor::Option::VALID_TYPES = T.let(T.unsafe(nil), Array)
|
3215
|
+
|
3216
|
+
# source://thor//lib/thor/parser/options.rb#2
|
3217
|
+
class Thor::Options < ::Thor::Arguments
|
3218
|
+
# Takes a hash of Thor::Option and a hash with defaults.
|
3219
|
+
#
|
3220
|
+
# If +stop_on_unknown+ is true, #parse will stop as soon as it encounters
|
3221
|
+
# an unknown option or a regular argument.
|
3222
|
+
#
|
3223
|
+
# @return [Options] a new instance of Options
|
3224
|
+
#
|
3225
|
+
# source://thor//lib/thor/parser/options.rb#32
|
3226
|
+
def initialize(hash_options = T.unsafe(nil), defaults = T.unsafe(nil), stop_on_unknown = T.unsafe(nil), disable_required_check = T.unsafe(nil), relations = T.unsafe(nil)); end
|
3227
|
+
|
3228
|
+
# source://thor//lib/thor/parser/options.rb#156
|
3229
|
+
def check_at_least_one!; end
|
3230
|
+
|
3231
|
+
# source://thor//lib/thor/parser/options.rb#144
|
3232
|
+
def check_exclusive!; end
|
3233
|
+
|
3234
|
+
# @raise [UnknownArgumentError]
|
3235
|
+
#
|
3236
|
+
# source://thor//lib/thor/parser/options.rb#168
|
3237
|
+
def check_unknown!; end
|
3238
|
+
|
3239
|
+
# source://thor//lib/thor/parser/options.rb#89
|
3240
|
+
def parse(args); end
|
3241
|
+
|
3242
|
+
# source://thor//lib/thor/parser/options.rb#65
|
3243
|
+
def peek; end
|
3244
|
+
|
3245
|
+
# source://thor//lib/thor/parser/options.rb#61
|
3246
|
+
def remaining; end
|
3247
|
+
|
3248
|
+
# source://thor//lib/thor/parser/options.rb#79
|
3249
|
+
def shift; end
|
3250
|
+
|
3251
|
+
# source://thor//lib/thor/parser/options.rb#84
|
3252
|
+
def unshift(arg, is_value: T.unsafe(nil)); end
|
3253
|
+
|
3254
|
+
protected
|
3255
|
+
|
3256
|
+
# source://thor//lib/thor/parser/options.rb#189
|
3257
|
+
def assign_result!(option, result); end
|
3258
|
+
|
3259
|
+
# Check if the current value in peek is a registered switch.
|
3260
|
+
#
|
3261
|
+
# Two booleans are returned. The first is true if the current value
|
3262
|
+
# starts with a hyphen; the second is true if it is a registered switch.
|
3263
|
+
#
|
3264
|
+
# @return [Boolean]
|
3265
|
+
#
|
3266
|
+
# source://thor//lib/thor/parser/options.rb#203
|
3267
|
+
def current_is_switch?; end
|
3268
|
+
|
3269
|
+
# @return [Boolean]
|
3270
|
+
#
|
3271
|
+
# source://thor//lib/thor/parser/options.rb#215
|
3272
|
+
def current_is_switch_formatted?; end
|
3273
|
+
|
3274
|
+
# @return [Boolean]
|
3275
|
+
#
|
3276
|
+
# source://thor//lib/thor/parser/options.rb#225
|
3277
|
+
def current_is_value?; end
|
3278
|
+
|
3279
|
+
# Option names changes to swith name or human name
|
3280
|
+
#
|
3281
|
+
# source://thor//lib/thor/parser/options.rb#179
|
3282
|
+
def names_to_switch_names(names = T.unsafe(nil)); end
|
3283
|
+
|
3284
|
+
# Check if the given argument is actually a shortcut.
|
3285
|
+
#
|
3286
|
+
# source://thor//lib/thor/parser/options.rb#244
|
3287
|
+
def normalize_switch(arg); end
|
3288
|
+
|
3289
|
+
# Parse boolean values which can be given as --foo=true or --foo for true values, or
|
3290
|
+
# --foo=false, --no-foo or --skip-foo for false values.
|
3291
|
+
#
|
3292
|
+
# source://thor//lib/thor/parser/options.rb#256
|
3293
|
+
def parse_boolean(switch); end
|
3294
|
+
|
3295
|
+
# Parse the value at the peek analyzing if it requires an input or not.
|
3296
|
+
#
|
3297
|
+
# source://thor//lib/thor/parser/options.rb#274
|
3298
|
+
def parse_peek(switch, option); end
|
3299
|
+
|
3300
|
+
# @return [Boolean]
|
3301
|
+
#
|
3302
|
+
# source://thor//lib/thor/parser/options.rb#248
|
3303
|
+
def parsing_options?; end
|
3304
|
+
|
3305
|
+
# @return [Boolean]
|
3306
|
+
#
|
3307
|
+
# source://thor//lib/thor/parser/options.rb#230
|
3308
|
+
def switch?(arg); end
|
3309
|
+
|
3310
|
+
# source://thor//lib/thor/parser/options.rb#234
|
3311
|
+
def switch_option(arg); end
|
3312
|
+
|
3313
|
+
class << self
|
3314
|
+
# Receives a hash and makes it switches.
|
3315
|
+
#
|
3316
|
+
# source://thor//lib/thor/parser/options.rb#11
|
3317
|
+
def to_switches(options); end
|
3318
|
+
end
|
3319
|
+
end
|
3320
|
+
|
3321
|
+
# source://thor//lib/thor/parser/options.rb#5
|
3322
|
+
Thor::Options::EQ_RE = T.let(T.unsafe(nil), Regexp)
|
3323
|
+
|
3324
|
+
# source://thor//lib/thor/parser/options.rb#3
|
3325
|
+
Thor::Options::LONG_RE = T.let(T.unsafe(nil), Regexp)
|
3326
|
+
|
3327
|
+
# source://thor//lib/thor/parser/options.rb#8
|
3328
|
+
Thor::Options::OPTS_END = T.let(T.unsafe(nil), String)
|
3329
|
+
|
3330
|
+
# source://thor//lib/thor/parser/options.rb#7
|
3331
|
+
Thor::Options::SHORT_NUM = T.let(T.unsafe(nil), Regexp)
|
3332
|
+
|
3333
|
+
# source://thor//lib/thor/parser/options.rb#4
|
3334
|
+
Thor::Options::SHORT_RE = T.let(T.unsafe(nil), Regexp)
|
3335
|
+
|
3336
|
+
# Allow either -x -v or -xv style for single char args
|
3337
|
+
#
|
3338
|
+
# source://thor//lib/thor/parser/options.rb#6
|
3339
|
+
Thor::Options::SHORT_SQ_RE = T.let(T.unsafe(nil), Regexp)
|
3340
|
+
|
3341
|
+
# Adds a compatibility layer to your Thor classes which allows you to use
|
3342
|
+
# rake package tasks. For example, to use rspec rake tasks, one can do:
|
3343
|
+
#
|
3344
|
+
# require 'thor/rake_compat'
|
3345
|
+
# require 'rspec/core/rake_task'
|
3346
|
+
#
|
3347
|
+
# class Default < Thor
|
3348
|
+
# include Thor::RakeCompat
|
3349
|
+
#
|
3350
|
+
# RSpec::Core::RakeTask.new(:spec) do |t|
|
3351
|
+
# t.spec_opts = ['--options', './.rspec']
|
3352
|
+
# t.spec_files = FileList['spec/**/*_spec.rb']
|
3353
|
+
# end
|
3354
|
+
# end
|
3355
|
+
#
|
3356
|
+
# source://thor//lib/thor/rake_compat.rb#20
|
3357
|
+
module Thor::RakeCompat
|
3358
|
+
include ::FileUtils::StreamUtils_
|
3359
|
+
include ::FileUtils
|
3360
|
+
include ::Rake::FileUtilsExt
|
3361
|
+
include ::Rake::DSL
|
3362
|
+
|
3363
|
+
class << self
|
3364
|
+
# @private
|
3365
|
+
#
|
3366
|
+
# source://thor//lib/thor/rake_compat.rb#27
|
3367
|
+
def included(base); end
|
3368
|
+
|
3369
|
+
# source://thor//lib/thor/rake_compat.rb#23
|
3370
|
+
def rake_classes; end
|
3371
|
+
end
|
3372
|
+
end
|
3373
|
+
|
3374
|
+
# source://thor//lib/thor/error.rb#95
|
3375
|
+
class Thor::RequiredArgumentMissingError < ::Thor::InvocationError; end
|
3376
|
+
|
3377
|
+
# source://thor//lib/thor/util.rb#4
|
3378
|
+
module Thor::Sandbox; end
|
3379
|
+
|
3380
|
+
# source://thor//lib/thor/shell.rb#23
|
3381
|
+
module Thor::Shell
|
3382
|
+
# Add shell to initialize config values.
|
3383
|
+
#
|
3384
|
+
# ==== Configuration
|
3385
|
+
# shell<Object>:: An instance of the shell to be used.
|
3386
|
+
#
|
3387
|
+
# ==== Examples
|
3388
|
+
#
|
3389
|
+
# class MyScript < Thor
|
3390
|
+
# argument :first, :type => :numeric
|
3391
|
+
# end
|
3392
|
+
#
|
3393
|
+
# MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new
|
3394
|
+
#
|
3395
|
+
# source://thor//lib/thor/shell.rb#44
|
3396
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
|
3397
|
+
|
3398
|
+
# source://thor//lib/thor/shell.rb#59
|
3399
|
+
def ask(*args, &block); end
|
3400
|
+
|
3401
|
+
# source://thor//lib/thor/shell.rb#59
|
3402
|
+
def error(*args, &block); end
|
3403
|
+
|
3404
|
+
# source://thor//lib/thor/shell.rb#59
|
3405
|
+
def file_collision(*args, &block); end
|
3406
|
+
|
3407
|
+
# source://thor//lib/thor/shell.rb#59
|
3408
|
+
def no?(*args, &block); end
|
3409
|
+
|
3410
|
+
# source://thor//lib/thor/shell.rb#59
|
3411
|
+
def print_in_columns(*args, &block); end
|
3412
|
+
|
3413
|
+
# source://thor//lib/thor/shell.rb#59
|
3414
|
+
def print_table(*args, &block); end
|
3415
|
+
|
3416
|
+
# source://thor//lib/thor/shell.rb#59
|
3417
|
+
def print_wrapped(*args, &block); end
|
3418
|
+
|
3419
|
+
# source://thor//lib/thor/shell.rb#59
|
3420
|
+
def say(*args, &block); end
|
3421
|
+
|
3422
|
+
# source://thor//lib/thor/shell.rb#59
|
3423
|
+
def say_error(*args, &block); end
|
3424
|
+
|
3425
|
+
# source://thor//lib/thor/shell.rb#59
|
3426
|
+
def say_status(*args, &block); end
|
3427
|
+
|
3428
|
+
# source://thor//lib/thor/shell.rb#59
|
3429
|
+
def set_color(*args, &block); end
|
3430
|
+
|
3431
|
+
# Holds the shell for the given Thor instance. If no shell is given,
|
3432
|
+
# it gets a default shell from Thor::Base.shell.
|
3433
|
+
#
|
3434
|
+
# source://thor//lib/thor/shell.rb#52
|
3435
|
+
def shell; end
|
3436
|
+
|
3437
|
+
# Sets the attribute shell
|
3438
|
+
#
|
3439
|
+
# @param value the value to set the attribute shell to.
|
3440
|
+
#
|
3441
|
+
# source://thor//lib/thor/shell.rb#25
|
3442
|
+
def shell=(_arg0); end
|
3443
|
+
|
3444
|
+
# source://thor//lib/thor/shell.rb#59
|
3445
|
+
def terminal_width(*args, &block); end
|
3446
|
+
|
3447
|
+
# Yields the given block with padding.
|
3448
|
+
#
|
3449
|
+
# source://thor//lib/thor/shell.rb#66
|
3450
|
+
def with_padding; end
|
3451
|
+
|
3452
|
+
# source://thor//lib/thor/shell.rb#59
|
3453
|
+
def yes?(*args, &block); end
|
3454
|
+
|
3455
|
+
protected
|
3456
|
+
|
3457
|
+
# Allow shell to be shared between invocations.
|
3458
|
+
#
|
3459
|
+
# source://thor//lib/thor/shell.rb#77
|
3460
|
+
def _shared_configuration; end
|
3461
|
+
end
|
3462
|
+
|
3463
|
+
# source://thor//lib/thor/shell/basic.rb#7
|
3464
|
+
class Thor::Shell::Basic
|
3465
|
+
# Initialize base, mute and padding to nil.
|
3466
|
+
#
|
3467
|
+
# @return [Basic] a new instance of Basic
|
3468
|
+
#
|
3469
|
+
# source://thor//lib/thor/shell/basic.rb#13
|
3470
|
+
def initialize; end
|
3471
|
+
|
3472
|
+
# Asks something to the user and receives a response.
|
3473
|
+
#
|
3474
|
+
# If a default value is specified it will be presented to the user
|
3475
|
+
# and allows them to select that value with an empty response. This
|
3476
|
+
# option is ignored when limited answers are supplied.
|
3477
|
+
#
|
3478
|
+
# If asked to limit the correct responses, you can pass in an
|
3479
|
+
# array of acceptable answers. If one of those is not supplied,
|
3480
|
+
# they will be shown a message stating that one of those answers
|
3481
|
+
# must be given and re-asked the question.
|
3482
|
+
#
|
3483
|
+
# If asking for sensitive information, the :echo option can be set
|
3484
|
+
# to false to mask user input from $stdin.
|
3485
|
+
#
|
3486
|
+
# If the required input is a path, then set the path option to
|
3487
|
+
# true. This will enable tab completion for file paths relative
|
3488
|
+
# to the current working directory on systems that support
|
3489
|
+
# Readline.
|
3490
|
+
#
|
3491
|
+
# ==== Example
|
3492
|
+
# ask("What is your name?")
|
3493
|
+
#
|
3494
|
+
# ask("What is the planet furthest from the sun?", :default => "Neptune")
|
3495
|
+
#
|
3496
|
+
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
|
3497
|
+
#
|
3498
|
+
# ask("What is your password?", :echo => false)
|
3499
|
+
#
|
3500
|
+
# ask("Where should the file be saved?", :path => true)
|
3501
|
+
#
|
3502
|
+
# source://thor//lib/thor/shell/basic.rb#80
|
3503
|
+
def ask(statement, *args); end
|
3504
|
+
|
3505
|
+
# Returns the value of attribute base.
|
3506
|
+
#
|
3507
|
+
# source://thor//lib/thor/shell/basic.rb#8
|
3508
|
+
def base; end
|
3509
|
+
|
3510
|
+
# Sets the attribute base
|
3511
|
+
#
|
3512
|
+
# @param value the value to set the attribute base to.
|
3513
|
+
#
|
3514
|
+
# source://thor//lib/thor/shell/basic.rb#8
|
3515
|
+
def base=(_arg0); end
|
3516
|
+
|
3517
|
+
# Called if something goes wrong during the execution. This is used by Thor
|
3518
|
+
# internally and should not be used inside your scripts. If something went
|
3519
|
+
# wrong, you can always raise an exception. If you raise a Thor::Error, it
|
3520
|
+
# will be rescued and wrapped in the method below.
|
3521
|
+
#
|
3522
|
+
# source://thor//lib/thor/shell/basic.rb#251
|
3523
|
+
def error(statement); end
|
3524
|
+
|
3525
|
+
# Deals with file collision and returns true if the file should be
|
3526
|
+
# overwritten and false otherwise. If a block is given, it uses the block
|
3527
|
+
# response as the content for the diff.
|
3528
|
+
#
|
3529
|
+
# ==== Parameters
|
3530
|
+
# destination<String>:: the destination file to solve conflicts
|
3531
|
+
# block<Proc>:: an optional block that returns the value to be used in diff and merge
|
3532
|
+
#
|
3533
|
+
# source://thor//lib/thor/shell/basic.rb#207
|
3534
|
+
def file_collision(destination); end
|
3535
|
+
|
3536
|
+
# Sets the output padding while executing a block and resets it.
|
3537
|
+
#
|
3538
|
+
# source://thor//lib/thor/shell/basic.rb#43
|
3539
|
+
def indent(count = T.unsafe(nil)); end
|
3540
|
+
|
3541
|
+
# Mute everything that's inside given block
|
3542
|
+
#
|
3543
|
+
# source://thor//lib/thor/shell/basic.rb#22
|
3544
|
+
def mute; end
|
3545
|
+
|
3546
|
+
# Check if base is muted
|
3547
|
+
#
|
3548
|
+
# @return [Boolean]
|
3549
|
+
#
|
3550
|
+
# source://thor//lib/thor/shell/basic.rb#31
|
3551
|
+
def mute?; end
|
3552
|
+
|
3553
|
+
# Asks the user a question and returns true if the user replies "n" or
|
3554
|
+
# "no".
|
3555
|
+
#
|
3556
|
+
# @return [Boolean]
|
3557
|
+
#
|
3558
|
+
# source://thor//lib/thor/shell/basic.rb#156
|
3559
|
+
def no?(statement, color = T.unsafe(nil)); end
|
3560
|
+
|
3561
|
+
# Returns the value of attribute padding.
|
3562
|
+
#
|
3563
|
+
# source://thor//lib/thor/shell/basic.rb#9
|
3564
|
+
def padding; end
|
3565
|
+
|
3566
|
+
# Sets the output padding, not allowing less than zero values.
|
3567
|
+
#
|
3568
|
+
# source://thor//lib/thor/shell/basic.rb#37
|
3569
|
+
def padding=(value); end
|
3570
|
+
|
3571
|
+
# Prints values in columns
|
3572
|
+
#
|
3573
|
+
# ==== Parameters
|
3574
|
+
# Array[String, String, ...]
|
3575
|
+
#
|
3576
|
+
# source://thor//lib/thor/shell/basic.rb#165
|
3577
|
+
def print_in_columns(array); end
|
3578
|
+
|
3579
|
+
# Prints a table.
|
3580
|
+
#
|
3581
|
+
# ==== Parameters
|
3582
|
+
# Array[Array[String, String, ...]]
|
3583
|
+
#
|
3584
|
+
# ==== Options
|
3585
|
+
# indent<Integer>:: Indent the first column by indent value.
|
3586
|
+
# colwidth<Integer>:: Force the first column to colwidth spaces wide.
|
3587
|
+
# borders<Boolean>:: Adds ascii borders.
|
3588
|
+
#
|
3589
|
+
# source://thor//lib/thor/shell/basic.rb#180
|
3590
|
+
def print_table(array, options = T.unsafe(nil)); end
|
3591
|
+
|
3592
|
+
# Prints a long string, word-wrapping the text to the current width of the
|
3593
|
+
# terminal display. Ideal for printing heredocs.
|
3594
|
+
#
|
3595
|
+
# ==== Parameters
|
3596
|
+
# String
|
3597
|
+
#
|
3598
|
+
# ==== Options
|
3599
|
+
# indent<Integer>:: Indent each line of the printed paragraph by indent value.
|
3600
|
+
#
|
3601
|
+
# source://thor//lib/thor/shell/basic.rb#194
|
3602
|
+
def print_wrapped(message, options = T.unsafe(nil)); end
|
3603
|
+
|
3604
|
+
# Say (print) something to the user. If the sentence ends with a whitespace
|
3605
|
+
# or tab character, a new line is not appended (print + flush). Otherwise
|
3606
|
+
# are passed straight to puts (behavior got from Highline).
|
3607
|
+
#
|
3608
|
+
# ==== Example
|
3609
|
+
# say("I know you knew that.")
|
3610
|
+
#
|
3611
|
+
# source://thor//lib/thor/shell/basic.rb#98
|
3612
|
+
def say(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
|
3613
|
+
|
3614
|
+
# Say (print) an error to the user. If the sentence ends with a whitespace
|
3615
|
+
# or tab character, a new line is not appended (print + flush). Otherwise
|
3616
|
+
# are passed straight to puts (behavior got from Highline).
|
3617
|
+
#
|
3618
|
+
# ==== Example
|
3619
|
+
# say_error("error: something went wrong")
|
3620
|
+
#
|
3621
|
+
# source://thor//lib/thor/shell/basic.rb#115
|
3622
|
+
def say_error(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
|
3623
|
+
|
3624
|
+
# Say a status with the given color and appends the message. Since this
|
3625
|
+
# method is used frequently by actions, it allows nil or false to be given
|
3626
|
+
# in log_status, avoiding the message from being shown. If a Symbol is
|
3627
|
+
# given in log_status, it's used as the color.
|
3628
|
+
#
|
3629
|
+
# source://thor//lib/thor/shell/basic.rb#130
|
3630
|
+
def say_status(status, message, log_status = T.unsafe(nil)); end
|
3631
|
+
|
3632
|
+
# Apply color to the given string with optional bold. Disabled in the
|
3633
|
+
# Thor::Shell::Basic class.
|
3634
|
+
#
|
3635
|
+
# source://thor//lib/thor/shell/basic.rb#258
|
3636
|
+
def set_color(string, *_arg1); end
|
3637
|
+
|
3638
|
+
# Asks the user a question and returns true if the user replies "y" or
|
3639
|
+
# "yes".
|
3640
|
+
#
|
3641
|
+
# @return [Boolean]
|
3642
|
+
#
|
3643
|
+
# source://thor//lib/thor/shell/basic.rb#149
|
3644
|
+
def yes?(statement, color = T.unsafe(nil)); end
|
3645
|
+
|
3646
|
+
protected
|
3647
|
+
|
3648
|
+
# source://thor//lib/thor/shell/basic.rb#362
|
3649
|
+
def answer_match(possibilities, answer, case_insensitive); end
|
3650
|
+
|
3651
|
+
# source://thor//lib/thor/shell/basic.rb#349
|
3652
|
+
def ask_filtered(statement, color, options); end
|
3653
|
+
|
3654
|
+
# source://thor//lib/thor/shell/basic.rb#332
|
3655
|
+
def ask_simply(statement, color, options); end
|
3656
|
+
|
3657
|
+
# @return [Boolean]
|
3658
|
+
#
|
3659
|
+
# source://thor//lib/thor/shell/basic.rb#269
|
3660
|
+
def can_display_colors?; end
|
3661
|
+
|
3662
|
+
# source://thor//lib/thor/shell/basic.rb#296
|
3663
|
+
def file_collision_help(block_given); end
|
3664
|
+
|
3665
|
+
# source://thor//lib/thor/shell/basic.rb#383
|
3666
|
+
def git_merge_tool; end
|
3667
|
+
|
3668
|
+
# @return [Boolean]
|
3669
|
+
#
|
3670
|
+
# source://thor//lib/thor/shell/basic.rb#286
|
3671
|
+
def is?(value); end
|
3672
|
+
|
3673
|
+
# source://thor//lib/thor/shell/basic.rb#273
|
3674
|
+
def lookup_color(color); end
|
3675
|
+
|
3676
|
+
# source://thor//lib/thor/shell/basic.rb#370
|
3677
|
+
def merge(destination, content); end
|
3678
|
+
|
3679
|
+
# source://thor//lib/thor/shell/basic.rb#379
|
3680
|
+
def merge_tool; end
|
3681
|
+
|
3682
|
+
# source://thor//lib/thor/shell/basic.rb#264
|
3683
|
+
def prepare_message(message, *color); end
|
3684
|
+
|
3685
|
+
# @return [Boolean]
|
3686
|
+
#
|
3687
|
+
# source://thor//lib/thor/shell/basic.rb#324
|
3688
|
+
def quiet?; end
|
3689
|
+
|
3690
|
+
# source://thor//lib/thor/shell/basic.rb#313
|
3691
|
+
def show_diff(destination, content); end
|
3692
|
+
|
3693
|
+
# source://thor//lib/thor/shell/basic.rb#282
|
3694
|
+
def stderr; end
|
3695
|
+
|
3696
|
+
# source://thor//lib/thor/shell/basic.rb#278
|
3697
|
+
def stdout; end
|
3698
|
+
|
3699
|
+
# @return [Boolean]
|
3700
|
+
#
|
3701
|
+
# source://thor//lib/thor/shell/basic.rb#328
|
3702
|
+
def unix?; end
|
3703
|
+
end
|
3704
|
+
|
3705
|
+
# Inherit from Thor::Shell::Basic and add set_color behavior. Check
|
3706
|
+
# Thor::Shell::Basic to see all available methods.
|
3707
|
+
#
|
3708
|
+
# source://thor//lib/thor/shell/color.rb#9
|
3709
|
+
class Thor::Shell::Color < ::Thor::Shell::Basic
|
3710
|
+
include ::LCSDiff
|
3711
|
+
|
3712
|
+
# Set color by using a string or one of the defined constants. If a third
|
3713
|
+
# option is set to true, it also adds bold to the string. This is based
|
3714
|
+
# on Highline implementation and it automatically appends CLEAR to the end
|
3715
|
+
# of the returned String.
|
3716
|
+
#
|
3717
|
+
# Pass foreground, background and bold options to this method as
|
3718
|
+
# symbols.
|
3719
|
+
#
|
3720
|
+
# Example:
|
3721
|
+
#
|
3722
|
+
# set_color "Hi!", :red, :on_white, :bold
|
3723
|
+
#
|
3724
|
+
# The available colors are:
|
3725
|
+
#
|
3726
|
+
# :bold
|
3727
|
+
# :black
|
3728
|
+
# :red
|
3729
|
+
# :green
|
3730
|
+
# :yellow
|
3731
|
+
# :blue
|
3732
|
+
# :magenta
|
3733
|
+
# :cyan
|
3734
|
+
# :white
|
3735
|
+
# :on_black
|
3736
|
+
# :on_red
|
3737
|
+
# :on_green
|
3738
|
+
# :on_yellow
|
3739
|
+
# :on_blue
|
3740
|
+
# :on_magenta
|
3741
|
+
# :on_cyan
|
3742
|
+
# :on_white
|
3743
|
+
#
|
3744
|
+
# source://thor//lib/thor/shell/color.rb#82
|
3745
|
+
def set_color(string, *colors); end
|
3746
|
+
|
3747
|
+
protected
|
3748
|
+
|
3749
|
+
# @return [Boolean]
|
3750
|
+
#
|
3751
|
+
# source://thor//lib/thor/shell/color.rb#110
|
3752
|
+
def are_colors_disabled?; end
|
3753
|
+
|
3754
|
+
# @return [Boolean]
|
3755
|
+
#
|
3756
|
+
# source://thor//lib/thor/shell/color.rb#106
|
3757
|
+
def are_colors_supported?; end
|
3758
|
+
|
3759
|
+
# @return [Boolean]
|
3760
|
+
#
|
3761
|
+
# source://thor//lib/thor/shell/color.rb#102
|
3762
|
+
def can_display_colors?; end
|
3763
|
+
end
|
3764
|
+
|
3765
|
+
# Set the terminal's foreground ANSI color to black.
|
3766
|
+
#
|
3767
|
+
# source://thor//lib/thor/shell/color.rb#18
|
3768
|
+
Thor::Shell::Color::BLACK = T.let(T.unsafe(nil), String)
|
3769
|
+
|
3770
|
+
# Set the terminal's foreground ANSI color to blue.
|
3771
|
+
#
|
3772
|
+
# source://thor//lib/thor/shell/color.rb#26
|
3773
|
+
Thor::Shell::Color::BLUE = T.let(T.unsafe(nil), String)
|
3774
|
+
|
3775
|
+
# The start of an ANSI bold sequence.
|
3776
|
+
#
|
3777
|
+
# source://thor//lib/thor/shell/color.rb#15
|
3778
|
+
Thor::Shell::Color::BOLD = T.let(T.unsafe(nil), String)
|
3779
|
+
|
3780
|
+
# Embed in a String to clear all previous ANSI sequences.
|
3781
|
+
#
|
3782
|
+
# source://thor//lib/thor/shell/color.rb#13
|
3783
|
+
Thor::Shell::Color::CLEAR = T.let(T.unsafe(nil), String)
|
3784
|
+
|
3785
|
+
# Set the terminal's foreground ANSI color to cyan.
|
3786
|
+
#
|
3787
|
+
# source://thor//lib/thor/shell/color.rb#30
|
3788
|
+
Thor::Shell::Color::CYAN = T.let(T.unsafe(nil), String)
|
3789
|
+
|
3790
|
+
# Set the terminal's foreground ANSI color to green.
|
3791
|
+
#
|
3792
|
+
# source://thor//lib/thor/shell/color.rb#22
|
3793
|
+
Thor::Shell::Color::GREEN = T.let(T.unsafe(nil), String)
|
3794
|
+
|
3795
|
+
# Set the terminal's foreground ANSI color to magenta.
|
3796
|
+
#
|
3797
|
+
# source://thor//lib/thor/shell/color.rb#28
|
3798
|
+
Thor::Shell::Color::MAGENTA = T.let(T.unsafe(nil), String)
|
3799
|
+
|
3800
|
+
# Set the terminal's background ANSI color to black.
|
3801
|
+
#
|
3802
|
+
# source://thor//lib/thor/shell/color.rb#35
|
3803
|
+
Thor::Shell::Color::ON_BLACK = T.let(T.unsafe(nil), String)
|
3804
|
+
|
3805
|
+
# Set the terminal's background ANSI color to blue.
|
3806
|
+
#
|
3807
|
+
# source://thor//lib/thor/shell/color.rb#43
|
3808
|
+
Thor::Shell::Color::ON_BLUE = T.let(T.unsafe(nil), String)
|
3809
|
+
|
3810
|
+
# Set the terminal's background ANSI color to cyan.
|
3811
|
+
#
|
3812
|
+
# source://thor//lib/thor/shell/color.rb#47
|
3813
|
+
Thor::Shell::Color::ON_CYAN = T.let(T.unsafe(nil), String)
|
3814
|
+
|
3815
|
+
# Set the terminal's background ANSI color to green.
|
3816
|
+
#
|
3817
|
+
# source://thor//lib/thor/shell/color.rb#39
|
3818
|
+
Thor::Shell::Color::ON_GREEN = T.let(T.unsafe(nil), String)
|
3819
|
+
|
3820
|
+
# Set the terminal's background ANSI color to magenta.
|
3821
|
+
#
|
3822
|
+
# source://thor//lib/thor/shell/color.rb#45
|
3823
|
+
Thor::Shell::Color::ON_MAGENTA = T.let(T.unsafe(nil), String)
|
3824
|
+
|
3825
|
+
# Set the terminal's background ANSI color to red.
|
3826
|
+
#
|
3827
|
+
# source://thor//lib/thor/shell/color.rb#37
|
3828
|
+
Thor::Shell::Color::ON_RED = T.let(T.unsafe(nil), String)
|
3829
|
+
|
3830
|
+
# Set the terminal's background ANSI color to white.
|
3831
|
+
#
|
3832
|
+
# source://thor//lib/thor/shell/color.rb#49
|
3833
|
+
Thor::Shell::Color::ON_WHITE = T.let(T.unsafe(nil), String)
|
3834
|
+
|
3835
|
+
# Set the terminal's background ANSI color to yellow.
|
3836
|
+
#
|
3837
|
+
# source://thor//lib/thor/shell/color.rb#41
|
3838
|
+
Thor::Shell::Color::ON_YELLOW = T.let(T.unsafe(nil), String)
|
3839
|
+
|
3840
|
+
# Set the terminal's foreground ANSI color to red.
|
3841
|
+
#
|
3842
|
+
# source://thor//lib/thor/shell/color.rb#20
|
3843
|
+
Thor::Shell::Color::RED = T.let(T.unsafe(nil), String)
|
3844
|
+
|
3845
|
+
# Set the terminal's foreground ANSI color to white.
|
3846
|
+
#
|
3847
|
+
# source://thor//lib/thor/shell/color.rb#32
|
3848
|
+
Thor::Shell::Color::WHITE = T.let(T.unsafe(nil), String)
|
3849
|
+
|
3850
|
+
# Set the terminal's foreground ANSI color to yellow.
|
3851
|
+
#
|
3852
|
+
# source://thor//lib/thor/shell/color.rb#24
|
3853
|
+
Thor::Shell::Color::YELLOW = T.let(T.unsafe(nil), String)
|
3854
|
+
|
3855
|
+
# source://thor//lib/thor/shell/column_printer.rb#5
|
3856
|
+
class Thor::Shell::ColumnPrinter
|
3857
|
+
# @return [ColumnPrinter] a new instance of ColumnPrinter
|
3858
|
+
#
|
3859
|
+
# source://thor//lib/thor/shell/column_printer.rb#8
|
3860
|
+
def initialize(stdout, options = T.unsafe(nil)); end
|
3861
|
+
|
3862
|
+
# Returns the value of attribute options.
|
3863
|
+
#
|
3864
|
+
# source://thor//lib/thor/shell/column_printer.rb#6
|
3865
|
+
def options; end
|
3866
|
+
|
3867
|
+
# source://thor//lib/thor/shell/column_printer.rb#14
|
3868
|
+
def print(array); end
|
3869
|
+
|
3870
|
+
# Returns the value of attribute stdout.
|
3871
|
+
#
|
3872
|
+
# source://thor//lib/thor/shell/column_printer.rb#6
|
3873
|
+
def stdout; end
|
3874
|
+
end
|
3875
|
+
|
3876
|
+
# Inherit from Thor::Shell::Basic and add set_color behavior. Check
|
3877
|
+
# Thor::Shell::Basic to see all available methods.
|
3878
|
+
#
|
3879
|
+
# source://thor//lib/thor/shell/html.rb#9
|
3880
|
+
class Thor::Shell::HTML < ::Thor::Shell::Basic
|
3881
|
+
include ::LCSDiff
|
3882
|
+
|
3883
|
+
# Ask something to the user and receives a response.
|
3884
|
+
#
|
3885
|
+
# ==== Example
|
3886
|
+
# ask("What is your name?")
|
3887
|
+
#
|
3888
|
+
# TODO: Implement #ask for Thor::Shell::HTML
|
3889
|
+
#
|
3890
|
+
# @raise [NotImplementedError]
|
3891
|
+
#
|
3892
|
+
# source://thor//lib/thor/shell/html.rb#73
|
3893
|
+
def ask(statement, color = T.unsafe(nil)); end
|
3894
|
+
|
3895
|
+
# Set color by using a string or one of the defined constants. If a third
|
3896
|
+
# option is set to true, it also adds bold to the string. This is based
|
3897
|
+
# on Highline implementation and it automatically appends CLEAR to the end
|
3898
|
+
# of the returned String.
|
3899
|
+
#
|
3900
|
+
# source://thor//lib/thor/shell/html.rb#54
|
3901
|
+
def set_color(string, *colors); end
|
3902
|
+
|
3903
|
+
protected
|
3904
|
+
|
3905
|
+
# @return [Boolean]
|
3906
|
+
#
|
3907
|
+
# source://thor//lib/thor/shell/html.rb#79
|
3908
|
+
def can_display_colors?; end
|
3909
|
+
end
|
3910
|
+
|
3911
|
+
# Set the terminal's foreground HTML color to black.
|
3912
|
+
#
|
3913
|
+
# source://thor//lib/thor/shell/html.rb#16
|
3914
|
+
Thor::Shell::HTML::BLACK = T.let(T.unsafe(nil), String)
|
3915
|
+
|
3916
|
+
# Set the terminal's foreground HTML color to blue.
|
3917
|
+
#
|
3918
|
+
# source://thor//lib/thor/shell/html.rb#24
|
3919
|
+
Thor::Shell::HTML::BLUE = T.let(T.unsafe(nil), String)
|
3920
|
+
|
3921
|
+
# The start of an HTML bold sequence.
|
3922
|
+
#
|
3923
|
+
# source://thor//lib/thor/shell/html.rb#13
|
3924
|
+
Thor::Shell::HTML::BOLD = T.let(T.unsafe(nil), String)
|
3925
|
+
|
3926
|
+
# Set the terminal's foreground HTML color to cyan.
|
3927
|
+
#
|
3928
|
+
# source://thor//lib/thor/shell/html.rb#28
|
3929
|
+
Thor::Shell::HTML::CYAN = T.let(T.unsafe(nil), String)
|
3930
|
+
|
3931
|
+
# Set the terminal's foreground HTML color to green.
|
3932
|
+
#
|
3933
|
+
# source://thor//lib/thor/shell/html.rb#20
|
3934
|
+
Thor::Shell::HTML::GREEN = T.let(T.unsafe(nil), String)
|
3935
|
+
|
3936
|
+
# Set the terminal's foreground HTML color to magenta.
|
3937
|
+
#
|
3938
|
+
# source://thor//lib/thor/shell/html.rb#26
|
3939
|
+
Thor::Shell::HTML::MAGENTA = T.let(T.unsafe(nil), String)
|
3940
|
+
|
3941
|
+
# Set the terminal's background HTML color to black.
|
3942
|
+
#
|
3943
|
+
# source://thor//lib/thor/shell/html.rb#33
|
3944
|
+
Thor::Shell::HTML::ON_BLACK = T.let(T.unsafe(nil), String)
|
3945
|
+
|
3946
|
+
# Set the terminal's background HTML color to blue.
|
3947
|
+
#
|
3948
|
+
# source://thor//lib/thor/shell/html.rb#41
|
3949
|
+
Thor::Shell::HTML::ON_BLUE = T.let(T.unsafe(nil), String)
|
3950
|
+
|
3951
|
+
# Set the terminal's background HTML color to cyan.
|
3952
|
+
#
|
3953
|
+
# source://thor//lib/thor/shell/html.rb#45
|
3954
|
+
Thor::Shell::HTML::ON_CYAN = T.let(T.unsafe(nil), String)
|
3955
|
+
|
3956
|
+
# Set the terminal's background HTML color to green.
|
3957
|
+
#
|
3958
|
+
# source://thor//lib/thor/shell/html.rb#37
|
3959
|
+
Thor::Shell::HTML::ON_GREEN = T.let(T.unsafe(nil), String)
|
3960
|
+
|
3961
|
+
# Set the terminal's background HTML color to magenta.
|
3962
|
+
#
|
3963
|
+
# source://thor//lib/thor/shell/html.rb#43
|
3964
|
+
Thor::Shell::HTML::ON_MAGENTA = T.let(T.unsafe(nil), String)
|
3965
|
+
|
3966
|
+
# Set the terminal's background HTML color to red.
|
3967
|
+
#
|
3968
|
+
# source://thor//lib/thor/shell/html.rb#35
|
3969
|
+
Thor::Shell::HTML::ON_RED = T.let(T.unsafe(nil), String)
|
3970
|
+
|
3971
|
+
# Set the terminal's background HTML color to white.
|
3972
|
+
#
|
3973
|
+
# source://thor//lib/thor/shell/html.rb#47
|
3974
|
+
Thor::Shell::HTML::ON_WHITE = T.let(T.unsafe(nil), String)
|
3975
|
+
|
3976
|
+
# Set the terminal's background HTML color to yellow.
|
3977
|
+
#
|
3978
|
+
# source://thor//lib/thor/shell/html.rb#39
|
3979
|
+
Thor::Shell::HTML::ON_YELLOW = T.let(T.unsafe(nil), String)
|
3980
|
+
|
3981
|
+
# Set the terminal's foreground HTML color to red.
|
3982
|
+
#
|
3983
|
+
# source://thor//lib/thor/shell/html.rb#18
|
3984
|
+
Thor::Shell::HTML::RED = T.let(T.unsafe(nil), String)
|
3985
|
+
|
3986
|
+
# Set the terminal's foreground HTML color to white.
|
3987
|
+
#
|
3988
|
+
# source://thor//lib/thor/shell/html.rb#30
|
3989
|
+
Thor::Shell::HTML::WHITE = T.let(T.unsafe(nil), String)
|
3990
|
+
|
3991
|
+
# Set the terminal's foreground HTML color to yellow.
|
3992
|
+
#
|
3993
|
+
# source://thor//lib/thor/shell/html.rb#22
|
3994
|
+
Thor::Shell::HTML::YELLOW = T.let(T.unsafe(nil), String)
|
3995
|
+
|
3996
|
+
# source://thor//lib/thor/shell.rb#24
|
3997
|
+
Thor::Shell::SHELL_DELEGATED_METHODS = T.let(T.unsafe(nil), Array)
|
3998
|
+
|
3999
|
+
# source://thor//lib/thor/shell/table_printer.rb#6
|
4000
|
+
class Thor::Shell::TablePrinter < ::Thor::Shell::ColumnPrinter
|
4001
|
+
# @return [TablePrinter] a new instance of TablePrinter
|
4002
|
+
#
|
4003
|
+
# source://thor//lib/thor/shell/table_printer.rb#9
|
4004
|
+
def initialize(stdout, options = T.unsafe(nil)); end
|
4005
|
+
|
4006
|
+
# source://thor//lib/thor/shell/table_printer.rb#18
|
4007
|
+
def print(array); end
|
4008
|
+
|
4009
|
+
private
|
4010
|
+
|
4011
|
+
# source://thor//lib/thor/shell/table_printer.rb#72
|
4012
|
+
def format_cell(column, row_size, index); end
|
4013
|
+
|
4014
|
+
# source://thor//lib/thor/shell/table_printer.rb#113
|
4015
|
+
def indentation; end
|
4016
|
+
|
4017
|
+
# source://thor//lib/thor/shell/table_printer.rb#47
|
4018
|
+
def prepare(array); end
|
4019
|
+
|
4020
|
+
# source://thor//lib/thor/shell/table_printer.rb#96
|
4021
|
+
def print_border_separator; end
|
4022
|
+
|
4023
|
+
# source://thor//lib/thor/shell/table_printer.rb#103
|
4024
|
+
def truncate(string); end
|
4025
|
+
end
|
4026
|
+
|
4027
|
+
# source://thor//lib/thor/shell/table_printer.rb#7
|
4028
|
+
Thor::Shell::TablePrinter::BORDER_SEPARATOR = T.let(T.unsafe(nil), Symbol)
|
4029
|
+
|
4030
|
+
# source://thor//lib/thor/shell/terminal.rb#3
|
4031
|
+
module Thor::Shell::Terminal
|
4032
|
+
class << self
|
4033
|
+
# source://thor//lib/thor/shell/terminal.rb#9
|
4034
|
+
def terminal_width; end
|
4035
|
+
|
4036
|
+
# @return [Boolean]
|
4037
|
+
#
|
4038
|
+
# source://thor//lib/thor/shell/terminal.rb#20
|
4039
|
+
def unix?; end
|
4040
|
+
|
4041
|
+
private
|
4042
|
+
|
4043
|
+
# Calculate the dynamic width of the terminal
|
4044
|
+
#
|
4045
|
+
# source://thor//lib/thor/shell/terminal.rb#27
|
4046
|
+
def dynamic_width; end
|
4047
|
+
|
4048
|
+
# source://thor//lib/thor/shell/terminal.rb#31
|
4049
|
+
def dynamic_width_stty; end
|
4050
|
+
|
4051
|
+
# source://thor//lib/thor/shell/terminal.rb#35
|
4052
|
+
def dynamic_width_tput; end
|
4053
|
+
end
|
4054
|
+
end
|
4055
|
+
|
4056
|
+
# source://thor//lib/thor/shell/terminal.rb#4
|
4057
|
+
Thor::Shell::Terminal::DEFAULT_TERMINAL_WIDTH = T.let(T.unsafe(nil), Integer)
|
4058
|
+
|
4059
|
+
# source://thor//lib/thor/shell/wrapped_printer.rb#6
|
4060
|
+
class Thor::Shell::WrappedPrinter < ::Thor::Shell::ColumnPrinter
|
4061
|
+
# source://thor//lib/thor/shell/wrapped_printer.rb#7
|
4062
|
+
def print(message); end
|
4063
|
+
end
|
4064
|
+
|
4065
|
+
# source://thor//lib/thor/base.rb#23
|
4066
|
+
Thor::TEMPLATE_EXTNAME = T.let(T.unsafe(nil), String)
|
4067
|
+
|
4068
|
+
# Thor methods that should not be overwritten by the user.
|
4069
|
+
#
|
4070
|
+
# source://thor//lib/thor/base.rb#20
|
4071
|
+
Thor::THOR_RESERVED_WORDS = T.let(T.unsafe(nil), Array)
|
4072
|
+
|
4073
|
+
# source://thor//lib/thor/command.rb#126
|
4074
|
+
Thor::Task = Thor::Command
|
4075
|
+
|
4076
|
+
# Raised when a command was not found.
|
4077
|
+
#
|
4078
|
+
# source://thor//lib/thor/error.rb#24
|
4079
|
+
class Thor::UndefinedCommandError < ::Thor::Error
|
4080
|
+
include ::Thor::Correctable
|
4081
|
+
|
4082
|
+
# @return [UndefinedCommandError] a new instance of UndefinedCommandError
|
4083
|
+
#
|
4084
|
+
# source://thor//lib/thor/error.rb#43
|
4085
|
+
def initialize(command, all_commands, namespace); end
|
4086
|
+
|
4087
|
+
# Returns the value of attribute all_commands.
|
4088
|
+
#
|
4089
|
+
# source://thor//lib/thor/error.rb#41
|
4090
|
+
def all_commands; end
|
4091
|
+
|
4092
|
+
# Returns the value of attribute command.
|
4093
|
+
#
|
4094
|
+
# source://thor//lib/thor/error.rb#41
|
4095
|
+
def command; end
|
4096
|
+
end
|
4097
|
+
|
4098
|
+
# source://thor//lib/thor/error.rb#25
|
4099
|
+
class Thor::UndefinedCommandError::SpellChecker
|
4100
|
+
# @return [SpellChecker] a new instance of SpellChecker
|
4101
|
+
#
|
4102
|
+
# source://thor//lib/thor/error.rb#28
|
4103
|
+
def initialize(error); end
|
4104
|
+
|
4105
|
+
# source://thor//lib/thor/error.rb#32
|
4106
|
+
def corrections; end
|
4107
|
+
|
4108
|
+
# Returns the value of attribute error.
|
4109
|
+
#
|
4110
|
+
# source://thor//lib/thor/error.rb#26
|
4111
|
+
def error; end
|
4112
|
+
|
4113
|
+
# source://thor//lib/thor/error.rb#36
|
4114
|
+
def spell_checker; end
|
4115
|
+
end
|
4116
|
+
|
4117
|
+
# source://thor//lib/thor/error.rb#55
|
4118
|
+
Thor::UndefinedTaskError = Thor::UndefinedCommandError
|
4119
|
+
|
4120
|
+
# source://thor//lib/thor/error.rb#65
|
4121
|
+
class Thor::UnknownArgumentError < ::Thor::Error
|
4122
|
+
include ::Thor::Correctable
|
4123
|
+
|
4124
|
+
# @return [UnknownArgumentError] a new instance of UnknownArgumentError
|
4125
|
+
#
|
4126
|
+
# source://thor//lib/thor/error.rb#85
|
4127
|
+
def initialize(switches, unknown); end
|
4128
|
+
|
4129
|
+
# Returns the value of attribute switches.
|
4130
|
+
#
|
4131
|
+
# source://thor//lib/thor/error.rb#83
|
4132
|
+
def switches; end
|
4133
|
+
|
4134
|
+
# Returns the value of attribute unknown.
|
4135
|
+
#
|
4136
|
+
# source://thor//lib/thor/error.rb#83
|
4137
|
+
def unknown; end
|
4138
|
+
end
|
4139
|
+
|
4140
|
+
# source://thor//lib/thor/error.rb#66
|
4141
|
+
class Thor::UnknownArgumentError::SpellChecker
|
4142
|
+
# @return [SpellChecker] a new instance of SpellChecker
|
4143
|
+
#
|
4144
|
+
# source://thor//lib/thor/error.rb#69
|
4145
|
+
def initialize(error); end
|
4146
|
+
|
4147
|
+
# source://thor//lib/thor/error.rb#73
|
4148
|
+
def corrections; end
|
4149
|
+
|
4150
|
+
# Returns the value of attribute error.
|
4151
|
+
#
|
4152
|
+
# source://thor//lib/thor/error.rb#67
|
4153
|
+
def error; end
|
4154
|
+
|
4155
|
+
# source://thor//lib/thor/error.rb#78
|
4156
|
+
def spell_checker; end
|
4157
|
+
end
|
4158
|
+
|
4159
|
+
# This module holds several utilities:
|
4160
|
+
#
|
4161
|
+
# 1) Methods to convert thor namespaces to constants and vice-versa.
|
4162
|
+
#
|
4163
|
+
# Thor::Util.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz"
|
4164
|
+
#
|
4165
|
+
# 2) Loading thor files and sandboxing:
|
4166
|
+
#
|
4167
|
+
# Thor::Util.load_thorfile("~/.thor/foo")
|
4168
|
+
#
|
4169
|
+
# source://thor//lib/thor/util.rb#17
|
4170
|
+
module Thor::Util
|
4171
|
+
class << self
|
4172
|
+
# Receives a string and convert it to camel case. camel_case returns CamelCase.
|
4173
|
+
#
|
4174
|
+
# ==== Parameters
|
4175
|
+
# String
|
4176
|
+
#
|
4177
|
+
# ==== Returns
|
4178
|
+
# String
|
4179
|
+
#
|
4180
|
+
# source://thor//lib/thor/util.rb#104
|
4181
|
+
def camel_case(str); end
|
4182
|
+
|
4183
|
+
# Returns a string that has had any glob characters escaped.
|
4184
|
+
# The glob characters are `* ? { } [ ]`.
|
4185
|
+
#
|
4186
|
+
# ==== Examples
|
4187
|
+
#
|
4188
|
+
# Thor::Util.escape_globs('[apps]') # => '\[apps\]'
|
4189
|
+
#
|
4190
|
+
# ==== Parameters
|
4191
|
+
# String
|
4192
|
+
#
|
4193
|
+
# ==== Returns
|
4194
|
+
# String
|
4195
|
+
#
|
4196
|
+
# source://thor//lib/thor/util.rb#264
|
4197
|
+
def escape_globs(path); end
|
4198
|
+
|
4199
|
+
# Returns a string that has had any HTML characters escaped.
|
4200
|
+
#
|
4201
|
+
# ==== Examples
|
4202
|
+
#
|
4203
|
+
# Thor::Util.escape_html('<div>') # => "<div>"
|
4204
|
+
#
|
4205
|
+
# ==== Parameters
|
4206
|
+
# String
|
4207
|
+
#
|
4208
|
+
# ==== Returns
|
4209
|
+
# String
|
4210
|
+
#
|
4211
|
+
# source://thor//lib/thor/util.rb#280
|
4212
|
+
def escape_html(string); end
|
4213
|
+
|
4214
|
+
# Receives a namespace and search for it in the Thor::Base subclasses.
|
4215
|
+
#
|
4216
|
+
# ==== Parameters
|
4217
|
+
# namespace<String>:: The namespace to search for.
|
4218
|
+
#
|
4219
|
+
# source://thor//lib/thor/util.rb#24
|
4220
|
+
def find_by_namespace(namespace); end
|
4221
|
+
|
4222
|
+
# Receives a namespace and tries to retrieve a Thor or Thor::Group class
|
4223
|
+
# from it. It first searches for a class using the all the given namespace,
|
4224
|
+
# if it's not found, removes the highest entry and searches for the class
|
4225
|
+
# again. If found, returns the highest entry as the class name.
|
4226
|
+
#
|
4227
|
+
# ==== Examples
|
4228
|
+
#
|
4229
|
+
# class Foo::Bar < Thor
|
4230
|
+
# def baz
|
4231
|
+
# end
|
4232
|
+
# end
|
4233
|
+
#
|
4234
|
+
# class Baz::Foo < Thor::Group
|
4235
|
+
# end
|
4236
|
+
#
|
4237
|
+
# Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
|
4238
|
+
# Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
|
4239
|
+
# Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
|
4240
|
+
#
|
4241
|
+
# ==== Parameters
|
4242
|
+
# namespace<String>
|
4243
|
+
#
|
4244
|
+
# source://thor//lib/thor/util.rb#131
|
4245
|
+
def find_class_and_command_by_namespace(namespace, fallback = T.unsafe(nil)); end
|
4246
|
+
|
4247
|
+
# Receives a namespace and tries to retrieve a Thor or Thor::Group class
|
4248
|
+
# from it. It first searches for a class using the all the given namespace,
|
4249
|
+
# if it's not found, removes the highest entry and searches for the class
|
4250
|
+
# again. If found, returns the highest entry as the class name.
|
4251
|
+
#
|
4252
|
+
# ==== Examples
|
4253
|
+
#
|
4254
|
+
# class Foo::Bar < Thor
|
4255
|
+
# def baz
|
4256
|
+
# end
|
4257
|
+
# end
|
4258
|
+
#
|
4259
|
+
# class Baz::Foo < Thor::Group
|
4260
|
+
# end
|
4261
|
+
#
|
4262
|
+
# Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
|
4263
|
+
# Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
|
4264
|
+
# Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
|
4265
|
+
#
|
4266
|
+
# ==== Parameters
|
4267
|
+
# namespace<String>
|
4268
|
+
#
|
4269
|
+
# source://thor//lib/thor/util.rb#131
|
4270
|
+
def find_class_and_task_by_namespace(namespace, fallback = T.unsafe(nil)); end
|
4271
|
+
|
4272
|
+
# Where to look for Thor files.
|
4273
|
+
#
|
4274
|
+
# source://thor//lib/thor/util.rb#213
|
4275
|
+
def globs_for(path); end
|
4276
|
+
|
4277
|
+
# Receives a path and load the thor file in the path. The file is evaluated
|
4278
|
+
# inside the sandbox to avoid namespacing conflicts.
|
4279
|
+
#
|
4280
|
+
# source://thor//lib/thor/util.rb#153
|
4281
|
+
def load_thorfile(path, content = T.unsafe(nil), debug = T.unsafe(nil)); end
|
4282
|
+
|
4283
|
+
# Receives a constant and converts it to a Thor namespace. Since Thor
|
4284
|
+
# commands can be added to a sandbox, this method is also responsible for
|
4285
|
+
# removing the sandbox namespace.
|
4286
|
+
#
|
4287
|
+
# This method should not be used in general because it's used to deal with
|
4288
|
+
# older versions of Thor. On current versions, if you need to get the
|
4289
|
+
# namespace from a class, just call namespace on it.
|
4290
|
+
#
|
4291
|
+
# ==== Parameters
|
4292
|
+
# constant<Object>:: The constant to be converted to the thor path.
|
4293
|
+
#
|
4294
|
+
# ==== Returns
|
4295
|
+
# String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
|
4296
|
+
#
|
4297
|
+
# source://thor//lib/thor/util.rb#43
|
4298
|
+
def namespace_from_thor_class(constant); end
|
4299
|
+
|
4300
|
+
# Given the contents, evaluate it inside the sandbox and returns the
|
4301
|
+
# namespaces defined in the sandbox.
|
4302
|
+
#
|
4303
|
+
# ==== Parameters
|
4304
|
+
# contents<String>
|
4305
|
+
#
|
4306
|
+
# ==== Returns
|
4307
|
+
# Array[Object]
|
4308
|
+
#
|
4309
|
+
# source://thor//lib/thor/util.rb#58
|
4310
|
+
def namespaces_in_content(contents, file = T.unsafe(nil)); end
|
4311
|
+
|
4312
|
+
# Return the path to the ruby interpreter taking into account multiple
|
4313
|
+
# installations and windows extensions.
|
4314
|
+
#
|
4315
|
+
# source://thor//lib/thor/util.rb#221
|
4316
|
+
def ruby_command; end
|
4317
|
+
|
4318
|
+
# Receives a string and convert it to snake case. SnakeCase returns snake_case.
|
4319
|
+
#
|
4320
|
+
# ==== Parameters
|
4321
|
+
# String
|
4322
|
+
#
|
4323
|
+
# ==== Returns
|
4324
|
+
# String
|
4325
|
+
#
|
4326
|
+
# source://thor//lib/thor/util.rb#90
|
4327
|
+
def snake_case(str); end
|
4328
|
+
|
4329
|
+
# Returns the thor classes declared inside the given class.
|
4330
|
+
#
|
4331
|
+
# source://thor//lib/thor/util.rb#74
|
4332
|
+
def thor_classes_in(klass); end
|
4333
|
+
|
4334
|
+
# Returns the root where thor files are located, depending on the OS.
|
4335
|
+
#
|
4336
|
+
# source://thor//lib/thor/util.rb#192
|
4337
|
+
def thor_root; end
|
4338
|
+
|
4339
|
+
# Returns the files in the thor root. On Windows thor_root will be something
|
4340
|
+
# like this:
|
4341
|
+
#
|
4342
|
+
# C:\Documents and Settings\james\.thor
|
4343
|
+
#
|
4344
|
+
# If we don't #gsub the \ character, Dir.glob will fail.
|
4345
|
+
#
|
4346
|
+
# source://thor//lib/thor/util.rb#203
|
4347
|
+
def thor_root_glob; end
|
4348
|
+
|
4349
|
+
# source://thor//lib/thor/util.rb#168
|
4350
|
+
def user_home; end
|
4351
|
+
end
|
4352
|
+
end
|