Class: RedisCopy::UI::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/redis-copy/ui/command_line.rb

Instance Method Summary collapse

Instance Method Details

#abort(message = nil) ⇒ Object



18
19
20
21
# File 'lib/redis-copy/ui/command_line.rb', line 18

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

#confirm?(prompt) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/redis-copy/ui/command_line.rb', line 10

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

#notify(message) ⇒ Object



23
24
25
# File 'lib/redis-copy/ui/command_line.rb', line 23

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