Method: Bundler::Thor::Base::ClassMethods#start
- Defined in:
- lib/bundler/vendor/thor/lib/thor/base.rb
#start(given_args = ARGV, config = {}) ⇒ Object
Parses the command and options from the given args, instantiate the class and invoke the command. This method is used when the arguments must be parsed from an array. If you are inside Ruby and want to use a Bundler::Thor class, you can simply initialize it:
script = MyScript.new(args, , config)
script.invoke(:command, first_arg, second_arg, third_arg)
438 439 440 441 442 443 444 445 446 447 448 449 450 |
# File 'lib/bundler/vendor/thor/lib/thor/base.rb', line 438 def start(given_args = ARGV, config = {}) config[:shell] ||= Bundler::Thor::Base.shell.new dispatch(nil, given_args.dup, nil, config) rescue Bundler::Thor::Error => e config[:debug] || ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.) exit(1) if exit_on_failure? rescue Errno::EPIPE # This happens if a thor command is piped to something like `head`, # which closes the pipe when it's done reading. This will also # mean that if the pipe is closed, further unnecessary # computation will not occur. exit(0) end |