Sha256: abc8d2ebd8866e92ebc29ef62679eab4c370ad7f9ed65b5861c47b5faede3809

Contents?: true

Size: 816 Bytes

Versions: 13

Compression:

Stored size: 816 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)
      terminal.ask(*args)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
opsicle-0.10.0 lib/opsicle/output.rb
opsicle-0.9.0 lib/opsicle/output.rb
opsicle-0.8.2 lib/opsicle/output.rb
opsicle-0.8.1 lib/opsicle/output.rb
opsicle-0.8.0 lib/opsicle/output.rb
opsicle-0.7.1 lib/opsicle/output.rb
opsicle-0.7.0 lib/opsicle/output.rb
opsicle-0.6.0 lib/opsicle/output.rb
opsicle-0.5.1 lib/opsicle/output.rb
opsicle-0.5.0 lib/opsicle/output.rb
opsicle-0.4.2 lib/opsicle/output.rb
opsicle-0.4.0 lib/opsicle/output.rb
opsicle-0.3.1 lib/opsicle/output.rb