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:
parent
52fed07749
commit
ea194d9b85
1 changed files with 16 additions and 1 deletions
|
@ -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' : '-')
|
||||
|
|
Loading…
Reference in a new issue