Class: CSD::UserInterface::CLI
- Includes:
- Gem::UserInteraction
- Defined in:
- lib/csd/user_interface/cli.rb
Instance Method Summary collapse
-
#continue? ⇒ Boolean
Be careful, this function writes to
STDOUTand not to$stdout. - #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #indicate_activity ⇒ Object
- #info(message) ⇒ Object
- #separator ⇒ Object
- #warn(message) ⇒ Object
Methods inherited from Base
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() $stdout.puts "DEBUG: #{}".magenta if Options.debug end |
#error(message) ⇒ Object
39 40 41 |
# File 'lib/csd/user_interface/cli.rb', line 39 def error() $stderr.puts('ERROR: '.red.blink + .red) end |
#indicate_activity ⇒ Object
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() $stdout.puts end |
#separator ⇒ Object
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() $stdout.puts 'NOTE: '.red + .red end |