Class: CSD::UserInterface::CLI

Inherits:
Base show all
Includes:
Gem::UserInteraction
Defined in:
lib/csd/user_interface/cli.rb

Instance Method Summary collapse

Methods inherited from Base

#ask_yes_no

Instance Method Details

#continue?Boolean

Be careful, this function writes to STDOUT and not to $stdout. In other words, the output cannot be hidden from the end-user, and thus, for example, not be properly tested in the test suite. ask_yes_no is provided by Gem::UserInteraction.



23
24
25
# File 'lib/csd/user_interface/cli.rb', line 23

def continue?
  ask_yes_no("Continue?".red.bold, true)
end

#debug(message) ⇒ Object



27
28
29
# File 'lib/csd/user_interface/cli.rb', line 27

def debug(message)
  $stdout.puts "DEBUG: #{message}".magenta if Options.debug
end

#error(message) ⇒ Object



39
40
41
# File 'lib/csd/user_interface/cli.rb', line 39

def error(message)
  $stderr.puts('ERROR: '.red.blink + message.red)
end

#indicate_activityObject



14
15
16
17
# File 'lib/csd/user_interface/cli.rb', line 14

def indicate_activity
  $stdout.putc '.'
  $stdout.flush
end

#info(message) ⇒ Object



31
32
33
# File 'lib/csd/user_interface/cli.rb', line 31

def info(message)
  $stdout.puts message
end

#separatorObject



10
11
12
# File 'lib/csd/user_interface/cli.rb', line 10

def separator
  $stdout.puts
end

#warn(message) ⇒ Object



35
36
37
# File 'lib/csd/user_interface/cli.rb', line 35

def warn(message)
  $stdout.puts 'NOTE: '.red + message.red
end