Sha256: 6dd181f2f221091984a407bd4a0544bf410bfc3634b17083fb24f9457bd22f09

Contents?: true

Size: 495 Bytes

Versions: 3

Compression:

Stored size: 495 Bytes

Contents

# encoding: utf-8

module RedisCopy
  module UI
    class CommandLine
      include UI

      def confirm?(prompt)
        $stderr.puts(prompt)
        return true unless @options[:prompt]
        $stderr.puts("Continue? [yN]")
        abort unless $stdin.gets.chomp =~ /y/i
        true
      end

      def abort(message = nil)
        notify(['ABORTED',message].compact.join(': '))
        exit 1
      end

      def notify(message)
        $stderr.puts(message)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis-copy-0.0.6 lib/redis-copy/ui/command_line.rb
redis-copy-0.0.5 lib/redis-copy/ui/command_line.rb
redis-copy-0.0.3 lib/redis-copy/ui/command_line.rb