Class: Bolt::Plugin::Prompt
- Inherits:
-
Object
- Object
- Bolt::Plugin::Prompt
- Defined in:
- lib/bolt/plugin/prompt.rb
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize ⇒ Prompt
constructor
A new instance of Prompt.
- #inventory_config(opts) ⇒ Object
- #name ⇒ Object
- #validate_inventory_config(opts) ⇒ Object
Constructor Details
#initialize ⇒ Prompt
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
#hooks ⇒ Object
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 |
#name ⇒ Object
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 |