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

- (Boolean) continue?

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.

Returns:

  • (Boolean)


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

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

- (Object) debug(message)



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

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

- (Object) error(message)



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

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

- (Object) indicate_activity



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

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

- (Object) info(message)



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

def info(message)
  $stdout.puts message
end

- (Object) separator



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

def separator
  $stdout.puts
end

- (Object) warn(message)



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

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