Class: PuppetDebugger::InputResponders::Resources

Inherits:
PuppetDebugger::InputResponderPlugin show all
Defined in:
lib/plugins/puppet-debugger/input_responders/resources.rb

Constant Summary collapse

COMMAND_WORDS =
%w(resources)
SUMMARY =
'List all the resources current in the catalog.'
COMMAND_GROUP =
:scope

Instance Attribute Summary

Attributes inherited from PuppetDebugger::InputResponderPlugin

#debugger

Instance Method Summary collapse

Methods inherited from PuppetDebugger::InputResponderPlugin

command_completion, command_group, command_words, details, execute, #modules_paths, #puppet_debugger_lib_dir, summary

Instance Method Details

#run(args = []) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/plugins/puppet-debugger/input_responders/resources.rb', line 9

def run(args = [])
  res = debugger.scope.compiler.catalog.resources.map do |res|
    res.to_s.gsub(/\[/, "['").gsub(/\]/, "']") # ensure the title has quotes
  end
  if !args.first.nil?
    res[args.first.to_i].ai
  else
    output = "Resources not shown in any specific order\n".warning
    output += res.ai
  end
end