lib/plugins/puppet-debugger/input_responders/set.rb in puppet-debugger-0.7.0 vs lib/plugins/puppet-debugger/input_responders/set.rb in puppet-debugger-0.8.0

- old
+ new

@@ -3,9 +3,29 @@ module InputResponders class Set < InputResponderPlugin COMMAND_WORDS = %w(set :set) SUMMARY = 'Set the a puppet debugger config' COMMAND_GROUP = :scope + KEYWORDS = %w(node loglevel) + LOGLEVELS = %w(debug info) + + def self.command_completion(buffer_words) + next_word = buffer_words.shift + case next_word + when 'loglevel' + if buffer_words.count > 0 + 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 def run(args = []) handle_set(args) end