Method: Thor::Base::ClassMethods#start
- Defined in:
- lib/thor/base.rb
#start(given_args = ARGV, config = {}) ⇒ Object
Parses the task and options from the given args, instantiate the class and invoke the task. This method is used when the arguments must be parsed from an array. If you are inside Ruby and want to use a Thor class, you can simply initialize it:
script = MyScript.new(args, , config)
script.invoke(:task, first_arg, second_arg, third_arg)
387 388 389 390 391 392 393 394 |
# File 'lib/thor/base.rb', line 387 def start(given_args=ARGV, config={}) self.debugging = given_args.delete("--debug") config[:shell] ||= Thor::Base.shell.new dispatch(nil, given_args.dup, nil, config) rescue Thor::Error => e debugging ? (raise e) : config[:shell].error(e.) exit(1) if exit_on_failure? end |