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-3.9.2 lib/bolt/plugin/prompt.rb
bolt-3.9.1 lib/bolt/plugin/prompt.rb
bolt-3.9.0 lib/bolt/plugin/prompt.rb
bolt-3.8.1 lib/bolt/plugin/prompt.rb
bolt-3.8.0 lib/bolt/plugin/prompt.rb
bolt-3.7.1 lib/bolt/plugin/prompt.rb
bolt-3.7.0 lib/bolt/plugin/prompt.rb
bolt-3.6.1 lib/bolt/plugin/prompt.rb
bolt-3.6.0 lib/bolt/plugin/prompt.rb
bolt-3.5.0 lib/bolt/plugin/prompt.rb
bolt-3.4.0 lib/bolt/plugin/prompt.rb
bolt-3.3.0 lib/bolt/plugin/prompt.rb
bolt-3.1.0 lib/bolt/plugin/prompt.rb
bolt-3.0.1 lib/bolt/plugin/prompt.rb
bolt-3.0.0 lib/bolt/plugin/prompt.rb
bolt-2.44.0 lib/bolt/plugin/prompt.rb
bolt-2.42.0 lib/bolt/plugin/prompt.rb
bolt-2.40.2 lib/bolt/plugin/prompt.rb
bolt-2.40.1 lib/bolt/plugin/prompt.rb
bolt-2.38.0 lib/bolt/plugin/prompt.rb