Sha256: be06b8b4d100a800eff188a40acce8a158e5a7d9e6c730227df036cba6553dfe

Contents?: true

Size: 626 Bytes

Versions: 9

Compression:

Stored size: 626 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 name
        'prompt'
      end

      def hooks
        ['inventory_config']
      end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bolt-1.30.1 lib/bolt/plugin/prompt.rb
bolt-1.30.0 lib/bolt/plugin/prompt.rb
bolt-1.29.1 lib/bolt/plugin/prompt.rb
bolt-1.29.0 lib/bolt/plugin/prompt.rb
bolt-1.28.0 lib/bolt/plugin/prompt.rb
bolt-1.27.1 lib/bolt/plugin/prompt.rb
bolt-1.27.0 lib/bolt/plugin/prompt.rb
bolt-1.26.0 lib/bolt/plugin/prompt.rb
bolt-1.25.0 lib/bolt/plugin/prompt.rb