Method: Morpheus::Cli::CliRegistry.exec_command

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

.exec_command(command_name, args) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/morpheus/cli/cli_registry.rb', line 75

def exec_command(command_name, args)
  #puts "exec_command(#{command_name}, #{args})"
  found_alias_command = instance.get_alias(command_name)
  if has_alias?(command_name)
    exec_alias(command_name, args)
  elsif has_command?(command_name)
    instance.get(command_name).new.handle(args)
  else
    # todo: need to just return error instead of raise
    raise Morpheus::Cli::CommandError.new("'#{command_name}' is not a command. See 'morpheus --help'.")
  end
end