class Thor::Arguments
def parse_hash(name)
{ "name" => "string", "age" => "integer" }
Becomes:
[ "name:string", "age:integer" ]
mark it as a hash:
Runs through the argument array getting strings that contains ":" and
def parse_hash(name) return shift if peek.is_a?(Hash) hash = {} while current_is_value? && peek.include?(":") key, value = shift.split(":", 2) raise MalformattedArgumentError, "You can't specify '#{key}' more than once in option '#{name}'; got #{key}:#{hash[key]} and #{key}:#{value}" if hash.include? key hash[key] = value end hash end