lib/hieracles/formats/console.rb in hieracles-0.1.7 vs lib/hieracles/formats/console.rb in hieracles-0.2.0

- old
+ new

@@ -53,33 +53,19 @@ output = '' if !filter || Regexp.new(filter).match(key) first = value.pop filecolor_index = @colors[first[:file]] filecolor = COLORS[filecolor_index] - if first[:merged] != first[:value] - output << format("%s #{COLORS[5]} %s\n", - "[-]", - key, - first[:merged].to_s.gsub('%', '%%') - ) - output << format(" #{COLORS[8]} #{COLORS[8]} #{COLORS[8]}\n", - "[#{filecolor_index}]", - key, - first[:value].to_s.gsub('%', '%%') - ) + if is_merged? first + output << format("%s #{COLORS[5]} %s\n", "[-]", key, sanitize(first[:merged]) ) + output << format(" #{COLORS[8]}\n", "[#{filecolor_index}] #{key} #{sanitize(first[:value])}" ) else - output << format("#{filecolor} #{COLORS[5]} %s\n", - "[#{filecolor_index}]", - key, - first[:value].to_s.gsub('%', '%%') - ) + output << format("#{filecolor} #{COLORS[5]} %s\n", "[#{filecolor_index}]", key, sanitize(first[:value]) ) end while value.count > 0 overriden = value.pop filecolor_index = @colors[overriden[:file]] - output << format(" #{COLORS[8]}\n", - "[#{filecolor_index}] #{key} #{overriden[:value]}" - ) + output << format(" #{COLORS[8]}\n", "[#{filecolor_index}] #{key} #{overriden[:value]}") end end output end