class Chef::Knife::HelperBuild

Public Instance Methods

run() click to toggle source
# 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