Sha256: 2ee1f2c46465af884f05783ca65a770b9100afab93b5c8da80d58fecdac5701b

Contents?: true

Size: 697 Bytes

Versions: 12

Compression:

Stored size: 697 Bytes

Contents

require "thor" unless defined?(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

12 entries across 12 versions & 1 rubygems

Version Path
berkshelf-8.0.15 lib/berkshelf/shell.rb
berkshelf-8.0.13 lib/berkshelf/shell.rb
berkshelf-8.0.12 lib/berkshelf/shell.rb
berkshelf-8.0.9 lib/berkshelf/shell.rb
berkshelf-8.0.7 lib/berkshelf/shell.rb
berkshelf-8.0.5 lib/berkshelf/shell.rb
berkshelf-8.0.2 lib/berkshelf/shell.rb
berkshelf-8.0.1 lib/berkshelf/shell.rb
berkshelf-8.0.0 lib/berkshelf/shell.rb
berkshelf-7.2.2 lib/berkshelf/shell.rb
berkshelf-7.2.1 lib/berkshelf/shell.rb
berkshelf-7.2.0 lib/berkshelf/shell.rb