class Thor
def normalize_command_name(meth) #:nodoc:
into +animal_prison+.
+normalize_command_name+ also converts names like +animal-prison+
a command or alias.
will determine if a shortened command is an unambiguous substring of
the commands hash. In addition to normalizing aliases, this logic
receives a (possibly nil) command name and returns a name that is in
def normalize_command_name(meth) #:nodoc: return default_command.to_s.gsub('-', '_') unless meth possibilities = find_command_possibilities(meth) if possibilities.size > 1 raise AmbiguousTaskError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" elsif possibilities.size < 1 meth = meth || default_command elsif map[meth] meth = map[meth] else meth = possibilities.first end meth.to_s.gsub('-','_') # treat foo-bar as foo_bar end