Sha256: 7f109748385923aeb249ac992de41632288652c7baafa3e9575eaead0c97a2c5

Contents?: true

Size: 720 Bytes

Versions: 27

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module Bolt
  class Plugin
    class Prompt
      def initialize(*_args); end

      def name
        'prompt'
      end

      def hooks
        hook_descriptions.keys
      end

      def hook_descriptions
        {
          resolve_reference: 'Prompt the user for a sensitive value.',
          validate_resolve_reference: nil
        }
      end

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

      def resolve_reference(opts)
        $stderr.print("#{opts['message']}: ")
        value = $stdin.noecho(&:gets).to_s.chomp
        $stderr.puts

        value
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bolt-4.0.0 lib/bolt/plugin/prompt.rb
bolt-3.29.0 lib/bolt/plugin/prompt.rb
bolt-3.28.0 lib/bolt/plugin/prompt.rb
bolt-3.27.4 lib/bolt/plugin/prompt.rb
bolt-3.27.2 lib/bolt/plugin/prompt.rb
bolt-3.27.1 lib/bolt/plugin/prompt.rb
bolt-3.26.2 lib/bolt/plugin/prompt.rb
bolt-3.26.1 lib/bolt/plugin/prompt.rb
bolt-3.25.0 lib/bolt/plugin/prompt.rb
bolt-3.24.0 lib/bolt/plugin/prompt.rb
bolt-3.23.1 lib/bolt/plugin/prompt.rb
bolt-3.23.0 lib/bolt/plugin/prompt.rb
bolt-3.22.1 lib/bolt/plugin/prompt.rb
bolt-3.22.0 lib/bolt/plugin/prompt.rb
bolt-3.21.0 lib/bolt/plugin/prompt.rb
bolt-3.20.0 lib/bolt/plugin/prompt.rb
bolt-3.19.0 lib/bolt/plugin/prompt.rb
bolt-3.18.0 lib/bolt/plugin/prompt.rb
bolt-3.17.0 lib/bolt/plugin/prompt.rb
bolt-3.16.1 lib/bolt/plugin/prompt.rb