Sha256: afb00bebd8b24d9b92d802ce6413bcca4dd0eaf799277fe55797c9a13ac6030d

Contents?: true

Size: 574 Bytes

Versions: 37

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

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

      def name
        'prompt'
      end

      def hooks
        %i[resolve_reference validate_resolve_reference]
      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

37 entries across 37 versions & 1 rubygems

Version Path
bolt-2.37.0 lib/bolt/plugin/prompt.rb
bolt-2.36.0 lib/bolt/plugin/prompt.rb
bolt-2.35.0 lib/bolt/plugin/prompt.rb
bolt-2.34.0 lib/bolt/plugin/prompt.rb
bolt-2.33.2 lib/bolt/plugin/prompt.rb
bolt-2.33.1 lib/bolt/plugin/prompt.rb
bolt-2.32.0 lib/bolt/plugin/prompt.rb
bolt-2.31.0 lib/bolt/plugin/prompt.rb
bolt-2.30.0 lib/bolt/plugin/prompt.rb
bolt-2.29.0 lib/bolt/plugin/prompt.rb
bolt-2.28.0 lib/bolt/plugin/prompt.rb
bolt-2.27.0 lib/bolt/plugin/prompt.rb
bolt-2.26.0 lib/bolt/plugin/prompt.rb
bolt-2.25.0 lib/bolt/plugin/prompt.rb
bolt-2.24.1 lib/bolt/plugin/prompt.rb
bolt-2.24.0 lib/bolt/plugin/prompt.rb
bolt-2.23.0 lib/bolt/plugin/prompt.rb