Method not available on this version
This method is only available on newer versions. The first available version (v2_6_3) is shown here.
dispatch(meth, given_args, given_opts, config)protected
The method responsible for dispatching given the args.
# File lib/bundler/vendor/thor/lib/thor.rb, line 354
def dispatch(meth, given_args, given_opts, config) #:nodoc: # rubocop:disable MethodLength
meth ||= retrieve_command_name(given_args)
command = all_commands[normalize_command_name(meth)]
if !command && config[:invoked_via_subcommand]
# We're a subcommand and our first argument didn't match any of our
# commands. So we put it back and call our default command.
given_args.unshift(meth)
command = all_commands[normalize_command_name(default_command)]
end
if command
args, opts = Bundler::Thor::Options.split(given_args)
if stop_on_unknown_option?(command) && !args.empty?
# given_args starts with a non-option, so we treat everything as
# ordinary arguments
args.concat opts
opts.clear
end
else
args = given_args
opts = nil
command = dynamic_command_class.new(meth)
end
opts = given_opts || opts || []
config[:current_command] = command
config[:command_options] = command.options
instance = new(args, opts, config)
yield instance if block_given?
args = instance.args
trailing = args[Range.new(arguments.size, -1)]
instance.invoke_command(command, trailing || [])
end Related methods
- Instance methods
- help
- Class methods
- check_unknown_options!
- check_unknown_options?
- command_help
- default_command
- default_task
- desc
- disable_required_check!
- disable_required_check?
- help
- long_desc
- map
- method_option
- method_options
- option
- options
- package_name
- printable_commands
- printable_tasks
- register
- stop_on_unknown_option!
- stop_on_unknown_option?
- subcommand
- subcommand_classes
- subcommands
- subtask
- subtasks
- task_help
- Protected methods
-
banner -
baseclass -
create_command -
create_task -
disable_required_check -
dispatch -
dynamic_command_class -
find_command_possibilities -
find_task_possibilities -
initialize_added -
normalize_command_name -
normalize_task_name -
retrieve_command_name -
retrieve_task_name -
stop_on_unknown_option -
subcommand_help -
subtask_help