Sha256: 5e5b648d63060735d1eb9c431457ec707c749674c7425fcba83d1fc75053b969

Contents?: true

Size: 589 Bytes

Versions: 6

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

class Shell
  def self.shell
    @shell ||= Thor::Shell::Color.new
  end

  def self.stderr
    @stderr ||= $stderr
  end

  def self.color(message, color_key)
    shell.set_color(message, color_key)
  end

  def self.confirm(message)
    shell.yes?("#{message} (y/n)")
  end

  def self.warn(message)
    stderr.puts(color("WARNING: #{message}\n", :yellow))
  end

  def self.warn_deprecated(message)
    stderr.puts(color("DEPRECATED: #{message}\n", :yellow))
  end

  def self.abort(message)
    Kernel.abort(color("ERROR: #{message}\n", :red))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cpl-0.4.1 lib/core/shell.rb
cpl-0.4.0 lib/core/shell.rb
cpl-0.3.3 lib/core/shell.rb
cpl-0.3.2 lib/core/shell.rb
cpl-0.3.1 lib/core/shell.rb
cpl-0.3.0 lib/core/shell.rb