class Thor::Options

def initialize(switches)


).parse(args)
["--level", "-l"] => :numeric
["--verbose", "-v"] => true,
"--debug" => true,
opts = Thor::Options.new(

Example:

first letter of the short switch. The default type is :boolean.
The long switch _must_ be provided. The short switch defaults to the

by the user.
for each key depends on the type of switch and/or the value provided
containing each switch name, minus the '-', as a key. The value
elements that indicate the name and type of switch. Returns a hash
Takes an array of switches. Each array consists of up to three
def initialize(switches)
  @defaults = {}
  @shorts = {}
  
  @leading_non_opts, @trailing_non_opts = [], []
  @switches = switches.inject({}) do |mem, (name, type)|
    if name.is_a?(Array)
      name, *shorts = name
    else
      name = name.to_s
      shorts = []
    end
    # we need both nice and dasherized form of switch name
    if name.index('-') == 0
      nice_name = undasherize name
    else
      nice_name = name
      name = dasherize name
    end
    # if there are no shortcuts specified, generate one using the first character
    shorts << "-" + nice_name[0,1] if shorts.empty? and nice_name.length > 1
    shorts.each { |short| @shorts[short] = name }
    
    # normalize type
    case type
    when TrueClass then type = :boolean
    when String
      @defaults[nice_name] = type
      type = :optional
    when Numeric
      @defaults[nice_name] = type
      type = :numeric
    end
    
    mem[name] = type
    mem
  end
  
  # remove shortcuts that happen to coincide with any of the main switches
  @shorts.keys.each do |short|
    @shorts.delete(short) if @switches.key?(short)
  end
end