0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-05 10:08:36 +02:00

modules/console: Add prefix filter param to conf list cmd.

This commit is contained in:
Jason Volk 2019-01-24 14:38:45 -08:00
parent 02b471eb95
commit 5b5a88c86a

View file

@ -921,12 +921,27 @@ console_cmd__aio(opt &out, const string_view &line)
bool
console_cmd__conf__list(opt &out, const string_view &line)
{
const params param{line, " ",
{
"prefix"
}};
const auto prefix
{
param.at("prefix", string_view{})
};
thread_local char val[4_KiB];
for(const auto &item : conf::items)
{
if(prefix && !startswith(item.first, prefix))
continue;
out
<< std::setw(64) << std::left << std::setfill('_') << item.first
<< " " << item.second->get(val) << "\033[0m"
<< std::endl;
}
return true;
}