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

modules/console: Add name filter condition to ctx list cmd.

This commit is contained in:
Jason Volk 2020-04-13 14:16:31 -07:00
parent 52fed07749
commit ea194d9b85

View file

@ -2365,6 +2365,16 @@ console_cmd__ctx__term(opt &out, const string_view &line)
bool
console_cmd__ctx__list(opt &out, const string_view &line)
{
const params param{line, " ",
{
"name",
}};
const auto name_filter
{
param["name"]
};
out << " "
<< std::setw(5)
<< "ID"
@ -2396,8 +2406,13 @@ console_cmd__ctx__list(opt &out, const string_view &line)
<< ":NAME"
<< std::endl;
ctx::for_each([&out](auto &ctx)
ctx::for_each([&out, &name_filter]
(auto &ctx)
{
if(name_filter)
if(name(ctx) != name_filter)
return true;
out << std::setw(5) << std::right << id(ctx);
out << " "
<< (started(ctx)? 'A' : '-')