Sha256: d38773e6c69904cc2cc269c91efe5bf280db88a0ec6ca3b57e659f27602c7cbd

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

require "thor"

module Berkshelf
  # Subclass the current shell (which is different based on the OS)
  Shell = Class.new(Thor::Base.shell) do
    # Mute the output of this instance of UI until {#unmute!} is called
    def mute!
      @mute = true
    end

    # Unmute the output of this instance of UI until {#mute!} is called
    def unmute!
      @mute = false
    end

    def say(*args)
      return if quiet?

      super(*args)
    end
    alias_method :info, :say

    def warn(message, color = :yellow)
      say(message, color)
    end

    def error(message, color = :red)
      message = set_color(message, *color) if color
      super(message)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkshelf-7.1.0 lib/berkshelf/shell.rb
berkshelf-7.0.10 lib/berkshelf/shell.rb
berkshelf-7.0.9 lib/berkshelf/shell.rb