Class: Bolt::Plugin::Prompt

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/plugin/prompt.rb

Instance Method Summary collapse

Constructor Details

#initializePrompt

Returns a new instance of Prompt.



7
8
9
10
# File 'lib/bolt/plugin/prompt.rb', line 7

def initialize
  # Might not need this
  @logger = Logging.logger[self]
end

Instance Method Details

#hooksObject



16
17
18
# File 'lib/bolt/plugin/prompt.rb', line 16

def hooks
  ['inventory_config']
end

#inventory_config(opts) ⇒ Object



24
25
26
27
28
29
# File 'lib/bolt/plugin/prompt.rb', line 24

def inventory_config(opts)
  STDOUT.print "#{opts['message']}:"
  value = STDIN.noecho(&:gets).chomp
  STDOUT.puts
  value
end

#nameObject



12
13
14
# File 'lib/bolt/plugin/prompt.rb', line 12

def name
  'prompt'
end

#validate_inventory_config(opts) ⇒ Object



20
21
22
# File 'lib/bolt/plugin/prompt.rb', line 20

def validate_inventory_config(opts)
  raise Bolt::ValidationError, "Prompt requires a 'message'" unless opts['message']
end