From 19c3bc829a9706cccd363d2a6ba111ae1806ad6d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 20 Sep 2017 18:41:25 +0200 Subject: [PATCH] Remove unused module --- doc/src/09020-changelog.md | 1 + lib/entry/libimagentrylist/src/cli.rs | 102 -------------------------- lib/entry/libimagentrylist/src/lib.rs | 1 - 3 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 lib/entry/libimagentrylist/src/cli.rs diff --git a/doc/src/09020-changelog.md b/doc/src/09020-changelog.md index b1bbde88..457e9d86 100644 --- a/doc/src/09020-changelog.md +++ b/doc/src/09020-changelog.md @@ -61,6 +61,7 @@ This section contains the changelog from the last release to the next release. dates and date-time start/stop times. * `libimagnotes` does not longer wrap store types but extend them. * `imag-notes` uses positional arguments now. + * `libimagentrylist` does not export a CLI helper module anymore. * Stats diff --git a/lib/entry/libimagentrylist/src/cli.rs b/lib/entry/libimagentrylist/src/cli.rs deleted file mode 100644 index e54deba0..00000000 --- a/lib/entry/libimagentrylist/src/cli.rs +++ /dev/null @@ -1,102 +0,0 @@ -// -// imag - the personal information management suite for the commandline -// Copyright (C) 2015, 2016 Matthias Beyer 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 clap::{Arg, ArgMatches, App, SubCommand}; - -use libimagstore::store::FileLockEntry; - -use error::Result; -use listers::line::LineLister; -use listers::path::PathLister; -use lister::Lister; -use error::ListErrorKind; -use error::ListError as LE; - -pub fn build_list_cli_component<'a, 'b>() -> App<'a, 'b> { - SubCommand::with_name(list_subcommand_name()) - .author("Matthias Beyer ") - .version("0.1") - .about("List entries") - - .arg(Arg::with_name(list_backend_line()) - .short("l") - .long("line") - .takes_value(false) - .required(false) - .multiple(false) - .help("Use backend: Line")) - - .arg(Arg::with_name(list_backend_path()) - .short("p") - .long("path") - .takes_value(false) - .required(false) - .multiple(false) - .help("Use backend: Path")) - - .arg(Arg::with_name(list_backend_path_absolute()) - .short("P") - .long("path-absolute") - .takes_value(false) - .required(false) - .multiple(false) - .help("Use backend: Path (absolute)")) - -} - -pub fn list_subcommand_name() -> &'static str { - "list" -} - -pub fn list_backend_line() -> &'static str { - "line" -} - -pub fn list_backend_path() -> &'static str { - "path" -} - -pub fn list_backend_path_absolute() -> &'static str { - "path-absolute" -} - -// TODO: Add Registry for listers where a HashMap name->lister is in and where we can fetch the -// lister from. -pub fn list_entries_with_lister<'a, I>(m: &ArgMatches, entries: I) -> Result<()> - where I: Iterator> -{ - if let Some(matches) = m.subcommand_matches(list_subcommand_name()) { - if matches.is_present(list_backend_line()) { - return LineLister::new("").list(entries) - }; - - if matches.is_present(list_backend_path()) { - return PathLister::new(false).list(entries) - } - - - if matches.is_present(list_backend_path_absolute()) { - return PathLister::new(true).list(entries) - } - - Ok(()) - } else { - Err(LE::from_kind(ListErrorKind::CLIError)) - } -} diff --git a/lib/entry/libimagentrylist/src/lib.rs b/lib/entry/libimagentrylist/src/lib.rs index 0f4748a4..cb430401 100644 --- a/lib/entry/libimagentrylist/src/lib.rs +++ b/lib/entry/libimagentrylist/src/lib.rs @@ -44,7 +44,6 @@ extern crate libimagstore; extern crate libimagutil; extern crate libimagerror; -pub mod cli; pub mod error; pub mod lister; pub mod listers;