]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add colour to diff output of pdnsutil 6063/head
authorRuben d'Arco <cyclops-github@prof-x.net>
Wed, 6 Dec 2017 21:08:21 +0000 (21:08 +0000)
committerRuben d'Arco <cyclops-github@prof-x.net>
Wed, 6 Dec 2017 21:09:02 +0000 (21:09 +0000)
Fixes #3760

pdns/pdnsutil.cc

index 05d5dee904bf389a35f9445eb10e348afb8aa2c5..d13f51c220d6a55f9cceaa3afb7909baef993e28 100644 (file)
@@ -918,7 +918,7 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) {
   set_difference(pre.cbegin(), pre.cend(), post.cbegin(), post.cend(), back_inserter(diff), DNSRecord::prettyCompare);
   for(const auto& d : diff) {
     ostringstream str;
-    str<<'-'<< d.d_name <<" "<<d.d_ttl<<" IN "<<DNSRecordContent::NumberToType(d.d_type)<<" "<<d.d_content->getZoneRepresentation(true)<<endl;
+    str<<"\033[0;31m-"<< d.d_name <<" "<<d.d_ttl<<" IN "<<DNSRecordContent::NumberToType(d.d_type)<<" "<<d.d_content->getZoneRepresentation(true)<<"\033[0m"<<endl;
     changed[{d.d_name,d.d_type}] += str.str();
 
   }
@@ -927,7 +927,7 @@ int editZone(DNSSECKeeper& dk, const DNSName &zone) {
   for(const auto& d : diff) {
     ostringstream str;
 
-    str<<'+'<< d.d_name <<" "<<d.d_ttl<<" IN "<<DNSRecordContent::NumberToType(d.d_type)<<" "<<d.d_content->getZoneRepresentation(true)<<endl;
+    str<<"\033[0;32m+"<< d.d_name <<" "<<d.d_ttl<<" IN "<<DNSRecordContent::NumberToType(d.d_type)<<" "<<d.d_content->getZoneRepresentation(true)<<"\033[0m"<<endl;
     changed[{d.d_name,d.d_type}]+=str.str();
   }
   if (changed.size() > 0)