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.tr("-", "_") unless meth possibilities = find_command_possibilities(meth) raise AmbiguousTaskError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" if possibilities.size > 1 if possibilities.empty? meth ||= default_command elsif map[meth] meth = map[meth] else meth = possibilities.first end meth.to_s.tr("-", "_") # treat foo-bar as foo_bar end