Module: CC::CLI::Output

Included in:
Command, VersionChecker
Defined in:
lib/cc/cli/output.rb

Instance Method Summary collapse

Instance Method Details

#colorize(string, *args) ⇒ Object



21
22
23
# File 'lib/cc/cli/output.rb', line 21

def colorize(string, *args)
  rainbow.wrap(string).color(*args)
end

#fatal(message) ⇒ Object



16
17
18
19
# File 'lib/cc/cli/output.rb', line 16

def fatal(message)
  $stderr.puts colorize(message, :red)
  exit 1
end

#rainbowObject



25
26
27
# File 'lib/cc/cli/output.rb', line 25

def rainbow
  @rainbow ||= Rainbow.new
end

#say(message) ⇒ Object



8
9
10
# File 'lib/cc/cli/output.rb', line 8

def say(message)
  terminal.say message
end

#success(message) ⇒ Object



4
5
6
# File 'lib/cc/cli/output.rb', line 4

def success(message)
  terminal.say colorize(message, :green)
end

#terminalObject



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

def terminal
  @terminal ||= HighLine.new($stdin, $stdout)
end

#warn(message) ⇒ Object



12
13
14
# File 'lib/cc/cli/output.rb', line 12

def warn(message)
  terminal.say colorize("WARNING: #{message}", :yellow)
end