diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-07-28 10:49:47 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-07-28 10:49:47 +0200 |
commit | 38021753a872ff2fbb9d2efb16e74ec4603fbf1a (patch) | |
tree | c2188dc9cad6de97942813e3ce33f604154acde7 /bin | |
parent | 109292c65a22c0097b6818d835e0ab2b0a5f04bb (diff) |
Remove in-collection filtering
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'bin')
-rw-r--r-- | bin/core/imag-ids/Cargo.toml | 1 | ||||
-rw-r--r-- | bin/core/imag-ids/src/id_filters.rs | 45 | ||||
-rw-r--r-- | bin/core/imag-ids/src/main.rs | 13 | ||||
-rw-r--r-- | bin/core/imag-ids/src/ui.rs | 9 |
4 files changed, 0 insertions, 68 deletions
diff --git a/bin/core/imag-ids/Cargo.toml b/bin/core/imag-ids/Cargo.toml index d4570a69..eca1fa39 100644 --- a/bin/core/imag-ids/Cargo.toml +++ b/bin/core/imag-ids/Cargo.toml @@ -20,7 +20,6 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" } maintenance = { status = "actively-developed" } [dependencies] -filters = "0.3.0" log = "0.4.6" toml = "0.5.1" toml-query = "0.9.2" diff --git a/bin/core/imag-ids/src/id_filters.rs b/bin/core/imag-ids/src/id_filters.rs deleted file mode 100644 index 55587098..00000000 --- a/bin/core/imag-ids/src/id_filters.rs +++ /dev/null @@ -1,45 +0,0 @@ -// -// imag - the personal information management suite for the commandline -// Copyright (C) 2015-2019 Matthias Beyer <mail@beyermatthias.de> and contributors -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; version -// 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -// - -use filters::filter::Filter; - -use libimagstore::storeid::StoreId; - -pub struct IsInCollectionsFilter<'a, A>(Option<A>, ::std::marker::PhantomData<&'a str>) - where A: AsRef<[&'a str]>; - -impl<'a, A> IsInCollectionsFilter<'a, A> - where A: AsRef<[&'a str]> -{ - pub fn new(collections: Option<A>) -> Self { - IsInCollectionsFilter(collections, ::std::marker::PhantomData) - } -} - -impl<'a, A> Filter<StoreId> for IsInCollectionsFilter<'a, A> - where A: AsRef<[&'a str]> + 'a -{ - fn filter(&self, sid: &StoreId) -> bool { - match self.0 { - Some(ref colls) => sid.is_in_collection(colls), - None => true, - } - } -} - diff --git a/bin/core/imag-ids/src/main.rs b/bin/core/imag-ids/src/main.rs index fbfdd420..29c16e73 100644 --- a/bin/core/imag-ids/src/main.rs +++ b/bin/core/imag-ids/src/main.rs @@ -35,7 +35,6 @@ )] extern crate clap; -extern crate filters; #[macro_use] extern crate log; extern crate toml; extern crate toml_query; @@ -50,8 +49,6 @@ extern crate libimagstore; use std::io::Write; -use filters::filter::Filter; - use libimagstore::storeid::StoreId; use libimagrt::setup::generate_runtime_setup; use libimagerror::trace::MapErrTrace; @@ -59,11 +56,9 @@ use libimagerror::iter::TraceIterator; use libimagerror::exit::ExitUnwrap; use libimagerror::io::ToExitCode; -mod id_filters; mod ui; use crate::ui::build_ui; -use crate::id_filters::IsInCollectionsFilter; fn main() { let version = make_imag_version!(); @@ -74,13 +69,6 @@ fn main() { let print_storepath = rt.cli().is_present("print-storepath"); - let values = rt - .cli() - .values_of("in-collection-filter") - .map(|v| v.collect::<Vec<&str>>()); - - let collection_filter = IsInCollectionsFilter::new(values); - let iterator = if rt.ids_from_stdin() { debug!("Fetching IDs from stdin..."); let ids = rt @@ -97,7 +85,6 @@ fn main() { as Box<Iterator<Item = Result<StoreId, _>>> } .trace_unwrap_exit() - .filter(|id| collection_filter.filter(id)) .map(|id| if print_storepath { (Some(rt.store().path()), id) } else { diff --git a/bin/core/imag-ids/src/ui.rs b/bin/core/imag-ids/src/ui.rs index 81903f69..4b5d8902 100644 --- a/bin/core/imag-ids/src/ui.rs +++ b/bin/core/imag-ids/src/ui.rs @@ -31,15 +31,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .required(false) .multiple(false) .help("Print the storepath for each id")) - - .arg(Arg::with_name("in-collection-filter") - .long("in-collection") - .short("c") - .required(false) - .takes_value(true) - .multiple(true) - .value_names(&["COLLECTION"]) - .help("Filter for ids which are only in these collections")) } pub struct PathProvider; |