Method: Thor::Options#check_unknown!

Defined in:
lib/thor/parser/options.rb

#check_unknown!Object



168
169
170
171
172
173
174
# File 'lib/thor/parser/options.rb', line 168

def check_unknown!
  to_check = @stopped_parsing_after_extra_index ? @extra[0...@stopped_parsing_after_extra_index] : @extra

  # an unknown option starts with - or -- and has no more --'s afterward.
  unknown = to_check.select { |str| str =~ /^--?(?:(?!--).)*$/ }
  raise UnknownArgumentError.new(@switches.keys, unknown) unless unknown.empty?
end