Class: Intent::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/intent/core.rb

Class Method Summary collapse

Class Method Details

.exec_command(command, args, output = STDOUT) ⇒ Object



167
168
169
170
# File 'lib/intent/core.rb', line 167

def self.exec_command(command, args, output=STDOUT)
  command = init_command(command).new
  command.run(args, output)
end

.init_command(command) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/intent/core.rb', line 172

def self.init_command(command)
  case command
  when :intent then return Commands::Intent
  when :inventory then return Commands::Inventory
  when :projects then return Commands::Projects
  when :project then return Commands::Project
  when :todo then return Commands::Todo
  else
    raise Commands::Errors::COMMAND_NOT_FOUND
  end
end