Class: Zypper::Upgraderepo::Messages

Inherits:
Object
  • Object
show all
Defined in:
lib/zypper/upgraderepo/utils.rb

Overview

Color the error message.

Class Method Summary collapse

Class Method Details

.error(err) ⇒ Object



114
115
116
117
118
119
120
121
122
# File 'lib/zypper/upgraderepo/utils.rb', line 114

def self.error(err)
  if err.instance_of?(String)
    puts " [E] ".bold.red + err
  elsif err.instance_of?(Interruption)
    warn err.message =~ /\(/ ? err.message.gsub(/.*\((.*)\).*/, '\1').green : err.message.green
  else
    warn "Error! ".bold.red + err.message
  end
end

.ok(msg) ⇒ Object



124
125
126
# File 'lib/zypper/upgraderepo/utils.rb', line 124

def self.ok(msg)
  puts " [V] ".bold.green + msg
end

.warning(msg) ⇒ Object



128
129
130
# File 'lib/zypper/upgraderepo/utils.rb', line 128

def self.warning(msg)
  puts " [W] ".bold.yellow + msg
end