class Thor

def check_unknown_options?(config) #:nodoc:

:nodoc:
Overwrite check_unknown_options? to take subcommands and options into account.
def check_unknown_options?(config) #:nodoc:
  options = check_unknown_options
  return false unless options
  task = config[:current_task]
  return true unless task
  name = task.name
  if subcommands.include?(name)
    false
  elsif options[:except]
    !options[:except].include?(name.to_sym)
  elsif options[:only]
    options[:only].include?(name.to_sym)
  else
    true
  end
end