From 4286d8b979f77d63346d4f4bbc43318eed29488f Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 25 Mar 2013 12:50:38 +0100 Subject: [PATCH] redis-trib: initial output colorization --- src/redis-trib.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/redis-trib.rb b/src/redis-trib.rb index 22e2c96c..4839fff1 100755 --- a/src/redis-trib.rb +++ b/src/redis-trib.rb @@ -27,7 +27,23 @@ require 'redis' ClusterHashSlots = 16384 def xputs(s) - puts s + case s[0..2] + when ">>>" + color="29;1" + when "[ER" + color="31;1" + when "[OK" + color="32" + when "[FA","***" + color="33" + else + color=nil + end + + print "\033[#{color}m" if color + print s + print "\033[0m" if color + print "\n" end class ClusterNode