Class: Chef::Knife::HelperBuild

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/helper_build.rb

Instance Method Summary collapse

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/chef/knife/helper_build.rb', line 17

def run
  conf = ::Knife::Helper::Config.new(config[:file])
  commands = ::Knife::Helper::Commands.new(
    conf.settings['command_base'],
    conf.commands,
    conf.option_sets
  )
  unless @name_args.empty?
    cm = commands.commands.select{|c| Regexp.new(@name_args.first).match(c['name']) }
  else
    cm = commands.commands
  end
  hash = {}
  cm.map! do |c|
    hash[c['name']] = commands.build(c['name'])
  end
  output(ui.presenter.format_for_display(hash))
end