Module: Opsicle::Output

Defined in:
lib/opsicle/output.rb

Class Method Summary collapse

Class Method Details

.ask(*args, &block) ⇒ Object



33
34
35
# File 'lib/opsicle/output.rb', line 33

def self.ask(*args, &block)
  terminal.ask(*args, &block)
end

.color_schemeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/opsicle/output.rb', line 10

def self.color_scheme
  @color_scheme ||= HighLine::ColorScheme.new(
      :normal => [],
      :error => [:bold, :red],
      :warning => [:bold, :yellow],
      :verbose => [:bold, :magenta],
      :debug => [:bold, :cyan],
      :success => [:bold, :green],
  )
end

.say(msg, log_style = :normal) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/opsicle/output.rb', line 21

def self.say(msg, log_style=:normal)
  if $color
    terminal.say "<%= color('#{msg}', '#{log_style}') %>"
  else
    terminal.say msg
  end
end

.say_verbose(msg) ⇒ Object



29
30
31
# File 'lib/opsicle/output.rb', line 29

def self.say_verbose(msg)
  terminal.say "<%= color('#{msg}', 'verbose') %>" if $verbose
end

.terminalObject



5
6
7
8
# File 'lib/opsicle/output.rb', line 5

def self.terminal
  HighLine.color_scheme = color_scheme
  @terminal ||= HighLine.new
end