Module: CC::CLI::Output
- Included in:
- Command, VersionChecker
- Defined in:
- lib/cc/cli/output.rb
Instance Method Summary collapse
- #colorize(string, *args) ⇒ Object
- #fatal(message) ⇒ Object
- #rainbow ⇒ Object
- #say(message) ⇒ Object
- #success(message) ⇒ Object
- #terminal ⇒ Object
- #warn(message) ⇒ Object
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() $stderr.puts colorize(, :red) exit 1 end |
#rainbow ⇒ Object
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() terminal.say end |
#success(message) ⇒ Object
4 5 6 |
# File 'lib/cc/cli/output.rb', line 4 def success() terminal.say colorize(, :green) end |
#terminal ⇒ Object
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() terminal.say colorize("WARNING: #{}", :yellow) end |