Module: WatchmonkeyCli::Application::OutputHelper

Included in:
WatchmonkeyCli::Application
Defined in:
lib/watchmonkey_cli/application/output_helper.rb

Instance Method Summary collapse

Instance Method Details

#abort(msg, exit_code = 1) ⇒ Object



24
25
26
27
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 24

def abort msg, exit_code = 1
  puts c("[ABORT] #{msg}", :red)
  exit(exit_code)
end

#debug(msg, lvl = 1) ⇒ Object



20
21
22
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 20

def debug msg, lvl = 1
  puts c("[DEBUG] #{msg}", :black) if @opts[:debug] && @opts[:debug] >= lvl
end

#error(msg) ⇒ Object



29
30
31
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 29

def error msg
  warn c(msg, :red)
end

#info(msg) ⇒ Object



16
17
18
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 16

def info msg
  puts c("[INFO]  #{msg}", :blue)
end


8
9
10
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 8

def print *a
  sync { @opts[:stdout].send(:print, *a) }
end

#puts(*a) ⇒ Object



4
5
6
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 4

def puts *a
  sync { @opts[:stdout].send(:puts, *a) }
end

#warn(*a) ⇒ Object



12
13
14
# File 'lib/watchmonkey_cli/application/output_helper.rb', line 12

def warn *a
  sync { @opts[:stdout].send(:warn, *a) }
end