Method: Morpheus::Cli::CliRegistry#add_alias

Defined in:
lib/morpheus/cli/cli_registry.rb

#add_alias(alias_name, command_string) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/morpheus/cli/cli_registry.rb', line 49

def add_alias(alias_name, command_string)
  #return @commands[alias_name.to_sym]
  if self.class.has_command?(alias_name)
    raise BadAlias.new "alias name '#{alias_name}' is invalid. That is the name of a morpheus command."
  elsif alias_name.to_s.downcase.strip == command_string.to_s.downcase.strip
    raise BadAlias.new "alias #{alias_name}=#{command_string} is invalid..."
  end
  @aliases[alias_name.to_sym] = command_string
end