Class: Bolt::Plugin::Prompt
- Inherits:
-
Object
- Object
- Bolt::Plugin::Prompt
- Defined in:
- lib/bolt/plugin/prompt.rb
Instance Method Summary collapse
- #hook_descriptions ⇒ Object
- #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
#hook_descriptions ⇒ Object
16 17 18 19 20 21 |
# File 'lib/bolt/plugin/prompt.rb', line 16 def hook_descriptions { resolve_reference: 'Prompt the user for a sensitive value.', validate_resolve_reference: nil } end |
#hooks ⇒ Object
12 13 14 |
# File 'lib/bolt/plugin/prompt.rb', line 12 def hooks hook_descriptions.keys end |
#name ⇒ Object
8 9 10 |
# File 'lib/bolt/plugin/prompt.rb', line 8 def name 'prompt' end |
#resolve_reference(opts) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/bolt/plugin/prompt.rb', line 27 def resolve_reference(opts) $stderr.print("#{opts['message']}: ") value = $stdin.noecho(&:gets).to_s.chomp $stderr.puts value end |
#validate_resolve_reference(opts) ⇒ Object
23 24 25 |
# File 'lib/bolt/plugin/prompt.rb', line 23 def validate_resolve_reference(opts) raise Bolt::ValidationError, "Prompt requires a 'message'" unless opts['message'] end |