Class: Bolt::Plugin::Prompt
- Inherits:
-
Object
- Object
- Bolt::Plugin::Prompt
- Defined in:
- lib/bolt/plugin/prompt.rb
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(*_args) ⇒ Prompt
constructor
A new instance of Prompt.
- #name ⇒ Object
- #resolve_reference(opts) ⇒ Object
- #validate_resolve_reference(opts) ⇒ Object
Constructor Details
#initialize(*_args) ⇒ Prompt
Returns a new instance of Prompt.
6 |
# File 'lib/bolt/plugin/prompt.rb', line 6 def initialize(*_args); end |
Instance Method Details
#hooks ⇒ Object
12 13 14 |
# File 'lib/bolt/plugin/prompt.rb', line 12 def hooks %i[resolve_reference validate_resolve_reference] end |
#name ⇒ Object
8 9 10 |
# File 'lib/bolt/plugin/prompt.rb', line 8 def name 'prompt' end |
#resolve_reference(opts) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bolt/plugin/prompt.rb', line 20 def resolve_reference(opts) STDERR.print("#{opts['message']}: ") value = STDIN.noecho(&:gets).to_s.chomp STDERR.puts value end |
#validate_resolve_reference(opts) ⇒ Object
16 17 18 |
# File 'lib/bolt/plugin/prompt.rb', line 16 def validate_resolve_reference(opts) raise Bolt::ValidationError, "Prompt requires a 'message'" unless opts['message'] end |