class PuppetDebugger::InputResponders::Resources

Constants

COMMAND_GROUP
COMMAND_WORDS
SUMMARY

Public Instance Methods

find_resources(resources, filter = []) click to toggle source
# File lib/plugins/puppet-debugger/input_responders/resources.rb, line 21
def find_resources(resources, filter = [])
  return resources if filter.nil? || filter.empty?

  filter_string = filter.join(' ').downcase
  resources.find_all do |resource|
    resource.name.to_s.downcase.include?(filter_string) || resource.type.to_s.downcase.include?(filter_string)
  end
end
run(args = []) click to toggle source
# File lib/plugins/puppet-debugger/input_responders/resources.rb, line 11
def run(args = [])
  filter = args
  resources = find_resources(debugger.catalog.resources, filter)
  modified = resources.map do |res|
    res.to_s.gsub(/\[/, "['").gsub(/\]/, "']") # ensure the title has quotes
  end
  output = "Resources not shown in any specific order\n".warning
  output + modified.ai
end