0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

modules/console: Add events subcommand accepting filter-JSON argument.

This commit is contained in:
Jason Volk 2018-04-19 13:54:33 -07:00
parent 1397091b7c
commit 0d4176a960

View file

@ -1508,6 +1508,34 @@ console_cmd__events(opt &out, const string_view &line)
return true;
}
bool
console_cmd__events__filter(opt &out, const string_view &line)
{
const params param{line, " ",
{
"start", "event_filter_json"
}};
const uint64_t start
{
param.at<uint64_t>(0, uint64_t(-1))
};
const m::event_filter filter
{
param.at(1)
};
m::events::rfor_each(start, filter, [&out]
(const uint64_t &seq, const m::event &event)
{
out << seq << " " << pretty_oneline(event) << std::endl;;
return true;
});
return true;
}
//
// event
//