From 8f46056a088107924e48195016b7c7535afa87ec Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 30 Dec 2015 14:51:42 +0100 Subject: [PATCH] BM::command_list() add filter functionality --- src/module/bm/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index a200a25d..a2b880ae 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -113,10 +113,16 @@ impl<'a> BM<'a> { use std::ops::Deref; let parser = Parser::new(JsonHeaderParser::new(None)); - let files = self.rt.store().load_for_module(self, &parser); + let filter : Box = 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()); - printer.print_files_custom(files.into_iter(), + printer.print_files_custom(files, &|file| { let fl = file.deref().borrow(); let hdr = fl.header();