BM::command_list() add filter functionality
This commit is contained in:
parent
9b1ba78c1f
commit
8f46056a08
1 changed files with 8 additions and 2 deletions
|
@ -113,10 +113,16 @@ impl<'a> BM<'a> {
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
let parser = Parser::new(JsonHeaderParser::new(None));
|
let parser = Parser::new(JsonHeaderParser::new(None));
|
||||||
let files = self.rt.store().load_for_module(self, &parser);
|
let filter : Box<CliFileFilter> = get_file_filter_by_cli(&parser, matches, "id", "match", "tags", Some("URL"));
|
||||||
|
|
||||||
|
let files = self.rt
|
||||||
|
.store()
|
||||||
|
.load_for_module(self, &parser)
|
||||||
|
.into_iter()
|
||||||
|
.filter(|file| filter.filter_file(file));
|
||||||
let printer = TablePrinter::new(self.rt.is_verbose(), self.rt.is_debugging());
|
let printer = TablePrinter::new(self.rt.is_verbose(), self.rt.is_debugging());
|
||||||
|
|
||||||
printer.print_files_custom(files.into_iter(),
|
printer.print_files_custom(files,
|
||||||
&|file| {
|
&|file| {
|
||||||
let fl = file.deref().borrow();
|
let fl = file.deref().borrow();
|
||||||
let hdr = fl.header();
|
let hdr = fl.header();
|
||||||
|
|
Loading…
Reference in a new issue