Sha256: e441d6492fa80b5b0820ed9f4273078048717fb01b23c7ec6041db7a640e615b

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

require 'highline'

module Opsicle
  module Output
    def self.terminal
      HighLine.color_scheme = color_scheme
      @terminal ||= HighLine.new
    end

    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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opsicle-0.12.0 lib/opsicle/output.rb
opsicle-0.11.0 lib/opsicle/output.rb