Class: PuppetDebugger::InputResponders::Set

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

Constant Summary collapse

COMMAND_WORDS =
%w[set :set].freeze
SUMMARY =
'Set the a puppet debugger config'
COMMAND_GROUP =
:scope
KEYWORDS =
%w[node loglevel].freeze
LOGLEVELS =
%w[debug info].freeze

Instance Attribute Summary

Attributes inherited from PuppetDebugger::InputResponderPlugin

#debugger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PuppetDebugger::InputResponderPlugin

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

Class Method Details

.command_completion(buffer_words) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/plugins/puppet-debugger/input_responders/set.rb', line 13

def self.command_completion(buffer_words)
  next_word = buffer_words.shift
  case next_word
  when 'loglevel'
    if buffer_words.count.positive?
      LOGLEVELS.grep(/^#{Regexp.escape(buffer_words.first)}/)
    else
      LOGLEVELS
    end
  when 'debug', 'info', 'node'
    []
  when nil
    %w[node loglevel]
  else
    KEYWORDS.grep(/^#{Regexp.escape(next_word)}/)
  end
end

Instance Method Details

#run(args = []) ⇒ Object



31
32
33
# File 'lib/plugins/puppet-debugger/input_responders/set.rb', line 31

def run(args = [])
  handle_set(args)
end