mirror of
https://github.com/matrix-construct/construct
synced 2025-02-18 09:40:12 +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
|
bool
|
||||||
console_cmd__ctx__list(opt &out, const string_view &line)
|
console_cmd__ctx__list(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
const params param{line, " ",
|
||||||
|
{
|
||||||
|
"name",
|
||||||
|
}};
|
||||||
|
|
||||||
|
const auto name_filter
|
||||||
|
{
|
||||||
|
param["name"]
|
||||||
|
};
|
||||||
|
|
||||||
out << " "
|
out << " "
|
||||||
<< std::setw(5)
|
<< std::setw(5)
|
||||||
<< "ID"
|
<< "ID"
|
||||||
|
@ -2396,8 +2406,13 @@ console_cmd__ctx__list(opt &out, const string_view &line)
|
||||||
<< ":NAME"
|
<< ":NAME"
|
||||||
<< std::endl;
|
<< 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 << std::setw(5) << std::right << id(ctx);
|
||||||
out << " "
|
out << " "
|
||||||
<< (started(ctx)? 'A' : '-')
|
<< (started(ctx)? 'A' : '-')
|
||||||
|
|
Loading…
Add table
Reference in a new issue