Sha256: 80829a6289eed5dffc2060431861903b1fbb5213995fecb11853b474090f2868

Contents?: true

Size: 674 Bytes

Versions: 29

Compression:

Stored size: 674 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

29 entries across 29 versions & 1 rubygems

Version Path
berkshelf-3.2.4 lib/berkshelf/shell.rb
berkshelf-3.2.3 lib/berkshelf/shell.rb
berkshelf-3.2.2 lib/berkshelf/shell.rb
berkshelf-3.2.1 lib/berkshelf/shell.rb
berkshelf-3.2.0 lib/berkshelf/shell.rb
berkshelf-3.1.5 lib/berkshelf/shell.rb
berkshelf-3.1.4 lib/berkshelf/shell.rb
berkshelf-3.1.3 lib/berkshelf/shell.rb
berkshelf-3.1.2 lib/berkshelf/shell.rb