Module: Opsicle::Output

Defined in:
lib/opsicle/output.rb

Class Method Summary collapse

Class Method Details

.ask(*args, &block) ⇒ Object



40
41
42
# File 'lib/opsicle/output.rb', line 40

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

.color_schemeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# 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],
      :addition => [:bold, :green],
      :removal => [:bold, :red],
      :modification => [:bold, :yellow],
  )
end

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



28
29
30
31
32
33
34
# File 'lib/opsicle/output.rb', line 28

def self.format(msg, log_style=:normal)
  if $color
    terminal.color(msg.to_s, log_style)
  else
    msg
  end
end

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



24
25
26
# File 'lib/opsicle/output.rb', line 24

def self.say(msg, log_style=:normal)
  terminal.say format(msg, log_style)
end

.say_verbose(msg) ⇒ Object



36
37
38
# File 'lib/opsicle/output.rb', line 36

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