Sha256: 20fc6fedf6bc53683f0978c045dceeb78b5a17c53f42454e5349896754db180d
Contents?: true
Size: 703 Bytes
Versions: 2
Compression:
Stored size: 703 Bytes
Contents
# frozen_string_literal: true require 'concurrent/delay' module Bolt class Plugin class Prompt def initialize # Might not need this @logger = Logging.logger[self] end def self.name 'prompt' end def hooks ['inventory_config_lookup'] end def inventory_config_lookup(opts) raise Bolt::ValidationError, "Prompt requires a 'message'" unless opts['message'] # Return a delay to only be evaluated when needed Concurrent::Delay.new do STDOUT.print "#{opts['message']}:" value = STDIN.noecho(&:gets).chomp STDOUT.puts value end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bolt-1.23.0 | lib/bolt/plugin/prompt.rb |
bolt-1.22.0 | lib/bolt/plugin/prompt.rb |