Module: Kitchen::CLI::PerformCommand

Included in:
Kitchen::CLI, Driver
Defined in:
lib/kitchen/cli.rb

Overview

Common module to load and invoke a CLI-implementation agnostic command.

Instance Method Summary collapse

Instance Method Details

#perform(task, command, args = nil, additional_options = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kitchen/cli.rb', line 35

def perform(task, command, args = nil, additional_options = {})
  require "kitchen/command/#{command}"

  command_options = {
    :action => task,
    :help => lambda { help(task) },
    :config => @config,
    :shell => shell
  }.merge(additional_options)

  str_const = Thor::Util.camel_case(command)
  klass = ::Kitchen::Command.const_get(str_const)
  klass.new(args, options, command_options).call
end