From 7f7ece5fb1bc7a2fb38c49f7069439ea205bb842 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 12 Dec 2018 09:36:02 -0800 Subject: [PATCH] modules/console: Omit zero values in db infos. --- modules/console.cc | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/modules/console.cc b/modules/console.cc index 06e5adb08..e38b83bae 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -3216,12 +3216,16 @@ try (const string_view &prop) { const auto name(lstrip(prop, "rocksdb.")); - closeout(name, [&out, &d, &c, &prop] + const auto val { - if(c) - out << db::property(c, prop); - else - out << db::property(d, prop); + c? + db::property(c, prop): + db::property(d, prop) + }; + + if(!!val) closeout(name, [&out, &val] + { + out << val; }); }}; @@ -3229,12 +3233,16 @@ try (const string_view &prop) { const auto name(lstrip(prop, "rocksdb.")); - closeout(name, [&out, &d, &c, &prop] + const auto val { - if(c) - out << pretty(iec(db::property(c, prop))); - else - out << pretty(iec(db::property(d, prop))); + c? + db::property(c, prop): + db::property(d, prop) + }; + + if(!!val) closeout(name, [&out, &val] + { + out << pretty(iec(val)); }); }};