0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

modules/console: Add preliminary stats cmd w/ item iteration.

This commit is contained in:
Jason Volk 2019-05-05 19:34:24 -07:00
parent 1bf17da6d1
commit b7677df49c

View file

@ -948,6 +948,35 @@ console_cmd__env(opt &out, const string_view &line)
return true;
}
//
// stats
//
bool
console_cmd__stats(opt &out, const string_view &line)
{
for(const auto &[name, item] : stats::items)
{
static constexpr size_t name_width {60};
assert(item);
const auto trunc_name(trunc(name, name_width));
out << std::left << std::setw(name_width) << trunc_name;
if(size(trunc_name) == name_width)
out << "...";
else
out << " ";
out << " "
<< std::left << (*item)
<< std::endl
;
}
return true;
}
//
// ios
//