0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-10 20:11:07 +01:00

modules/console: Add db columns listing cmd; add ID to output.

This commit is contained in:
Jason Volk 2018-10-22 07:10:23 -07:00
parent 8be65012ec
commit 87224e8cf4

View file

@ -2102,6 +2102,7 @@ _print_sst_info_header(opt &out)
<< " " << std::setw(25) << "sequence number" << " " << std::setw(25) << "sequence number"
<< " " << std::setw(32) << "creation" << " " << std::setw(32) << "creation"
<< " " << std::setw(3) << "lev" << " " << std::setw(3) << "lev"
<< " " << std::setw(2) << "ID"
<< std::left << std::left
<< " " << std::setw(20) << "column" << " " << std::setw(20) << "column"
<< std::endl; << std::endl;
@ -2135,6 +2136,7 @@ _print_sst_info(opt &out,
<< " " << std::setw(11) << std::right << f.min_seq << " : " << std::setw(11) << std::left << f.max_seq << " " << std::setw(11) << std::right << f.min_seq << " : " << std::setw(11) << std::left << f.max_seq
<< " " << std::setw(32) << std::right << timestr(f.created, ircd::localtime) << " " << std::setw(32) << std::right << timestr(f.created, ircd::localtime)
<< " " << std::setw(3) << std::right << f.level << " " << std::setw(3) << std::right << f.level
<< " " << std::setw(2) << std::right << f.cfid
<< " " << std::setw(20) << std::left << f.column << " " << std::setw(20) << std::left << f.column
<< std::endl; << std::endl;
} }
@ -2701,6 +2703,37 @@ console_cmd__db__list(opt &out, const string_view &line)
return true; return true;
} }
bool
console_cmd__db__columns(opt &out, const string_view &line)
try
{
const params param{line, " ",
{
"dbname"
}};
auto &d
{
db::database::get(param.at("dbname"))
};
for(const auto &c : d.columns)
{
const db::column &column(*c);
out << '[' << std::setw(3) << std::right << db::id(column) << ']'
<< " " << std::setw(18) << std::left << db::name(column)
<< " " << std::setw(25) << std::right << pretty(iec(bytes(column)))
<< std::endl;
}
return true;
}
catch(const std::out_of_range &e)
{
out << "No open database by that name" << std::endl;
return true;
}
bool bool
console_cmd__db__info(opt &out, const string_view &line) console_cmd__db__info(opt &out, const string_view &line)
try try