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:
parent
1bf17da6d1
commit
b7677df49c
1 changed files with 29 additions and 0 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue