class Thor::Group

def dispatch(task, given_args, given_opts, config) #:nodoc:

:nodoc:
The method responsible for dispatching given the args.
def dispatch(task, given_args, given_opts, config) #:nodoc:
  if Thor::HELP_MAPPINGS.include?(given_args.first)
    help(config[:shell])
    return
  end
  args, opts = Thor::Options.split(given_args)
  opts = given_opts || opts
  instance = new(args, opts, config)
  yield instance if block_given?
  args = instance.args
  if task
    instance.invoke_task(all_tasks[task])
  else
    instance.invoke_all
  end
end