summaryrefslogtreecommitdiffstats
path: root/lib/entry
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-02-20 13:20:02 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-02-20 15:02:46 +0100
commit5773e8a6c823cbaff957968f940ad85c17191d92 (patch)
treecdcd0d690ddc602e2671d242fa04c445690a2dcf /lib/entry
parent027c4b32870be5df7357a82a760534a4f54497af (diff)
Remove libimagentrylist
Diffstat (limited to 'lib/entry')
-rw-r--r--lib/entry/libimagentrylist/Cargo.toml35
l---------lib/entry/libimagentrylist/README.md1
-rw-r--r--lib/entry/libimagentrylist/src/error.rs53
-rw-r--r--lib/entry/libimagentrylist/src/lib.rs50
-rw-r--r--lib/entry/libimagentrylist/src/lister.rs29
-rw-r--r--lib/entry/libimagentrylist/src/listers/core.rs65
-rw-r--r--lib/entry/libimagentrylist/src/listers/line.rs56
-rw-r--r--lib/entry/libimagentrylist/src/listers/mod.rs23
-rw-r--r--lib/entry/libimagentrylist/src/listers/path.rs64
-rw-r--r--lib/entry/libimagentrylist/src/listers/table.rs128
10 files changed, 0 insertions, 504 deletions
diff --git a/lib/entry/libimagentrylist/Cargo.toml b/lib/entry/libimagentrylist/Cargo.toml
deleted file mode 100644
index 25adb9d2..00000000
--- a/lib/entry/libimagentrylist/Cargo.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-[package]
-name = "libimagentrylist"
-version = "0.7.0"
-authors = ["Matthias Beyer <mail@beyermatthias.de>"]
-
-description = "Library for the imag core distribution"
-
-keywords = ["imag", "PIM", "personal", "information", "management"]
-readme = "../../../README.md"
-license = "LGPL-2.1"
-
-documentation = "https://matthiasbeyer.github.io/imag/imag_documentation/index.html"
-repository = "https://github.com/matthiasbeyer/imag"
-homepage = "http://imag-pim.org"
-
-[badges]
-travis-ci = { repository = "matthiasbeyer/imag" }
-is-it-maintained-issue-resolution = { repository = "matthiasbeyer/imag" }
-is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
-maintenance = { status = "actively-developed" }
-
-[dependencies]
-log = "0.4.0"
-prettytable-rs = "0.6.*"
-error-chain = "0.11"
-
-libimagstore = { version = "0.7.0", path = "../../../lib/core/libimagstore" }
-libimagerror = { version = "0.7.0", path = "../../../lib/core/libimagerror" }
-libimagutil = { version = "0.7.0", path = "../../../lib/etc/libimagutil" }
-
-[dependencies.clap]
-version = ">=2.29"
-default-features = false
-features = ["color", "suggestions"]
-
diff --git a/lib/entry/libimagentrylist/README.md b/lib/entry/libimagentrylist/README.md
deleted file mode 120000
index 914fa13f..00000000
--- a/lib/entry/libimagentrylist/README.md
+++ /dev/null
@@ -1 +0,0 @@
-../../../doc/src/05100-lib-entrylist.md \ No newline at end of file
diff --git a/lib/entry/libimagentrylist/src/error.rs b/lib/entry/libimagentrylist/src/error.rs
deleted file mode 100644
index 8ecd6bfc..00000000
--- a/lib/entry/libimagentrylist/src/error.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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
-//
-
-error_chain! {
- types {
- ListError, ListErrorKind, ResultExt, Result;
- }
-
- errors {
- IOError {
- description("IO Error")
- display("IO Error")
- }
-
- FormatError {
- description("FormatError")
- display("FormatError")
- }
-
- EntryError {
- description("EntryError")
- display("EntryError")
- }
-
- IterationError {
- description("IterationError")
- display("IterationError")
- }
-
- CLIError {
- description("No CLI subcommand for listing entries")
- display("No CLI subcommand for listing entries")
- }
-
- }
-}
-
diff --git a/lib/entry/libimagentrylist/src/lib.rs b/lib/entry/libimagentrylist/src/lib.rs
deleted file mode 100644
index 1828541f..00000000
--- a/lib/entry/libimagentrylist/src/lib.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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
-//
-
-#![recursion_limit="256"]
-
-#![deny(
- dead_code,
- non_camel_case_types,
- non_snake_case,
- path_statements,
- trivial_numeric_casts,
- unstable_features,
- unused_allocation,
- unused_import_braces,
- unused_imports,
- unused_must_use,
- unused_mut,
- unused_qualifications,
- while_true,
-)]
-
-extern crate clap;
-#[macro_use] extern crate log;
-extern crate prettytable;
-#[macro_use] extern crate error_chain;
-
-extern crate libimagstore;
-extern crate libimagutil;
-extern crate libimagerror;
-
-pub mod error;
-pub mod lister;
-pub mod listers;
-
diff --git a/lib/entry/libimagentrylist/src/lister.rs b/lib/entry/libimagentrylist/src/lister.rs
deleted file mode 100644
index 29287cb8..00000000
--- a/lib/entry/libimagentrylist/src/lister.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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 libimagstore::store::FileLockEntry;
-
-use error::Result;
-
-pub trait Lister : Sized {
-
- fn list<'a, I: Iterator<Item = FileLockEntry<'a>>>(&self, entries: I) -> Result<()>;
-
-}
-
diff --git a/lib/entry/libimagentrylist/src/listers/core.rs b/lib/entry/libimagentrylist/src/listers/core.rs
deleted file mode 100644
index 09d39039..00000000
--- a/lib/entry/libimagentrylist/src/listers/core.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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 std::io::stdout;
-use std::io::Write;
-
-use lister::Lister;
-use error::Result;
-use error::ResultExt;
-
-use libimagstore::store::FileLockEntry;
-use libimagstore::store::Entry;
-
-pub struct CoreLister<T: Fn(&Entry) -> String> {
- lister: Box<T>,
-}
-
-impl<T: Fn(&Entry) -> String> CoreLister<T> {
-
- pub fn new(lister: T) -> CoreLister<T> {
- CoreLister {
- lister: Box::new(lister),
- }
- }
-
-}
-
-impl<T: Fn(&Entry) -> String> Lister for CoreLister<T> {
-
- fn list<'b, I: Iterator<Item = FileLockEntry<'b>>>(&self, entries: I) -> Result<()> {
- use error::ListErrorKind as LEK;
-
- debug!("Called list()");
- let (r, n) = entries
- .fold((Ok(()), 0), |(accu, i), entry| {
- debug!("fold({:?}, {:?})", accu, entry);
- let r = accu.and_then(|_| {
- debug!("Listing Entry: {:?}", entry);
- write!(stdout(), "{:?}\n", (self.lister)(&entry))
- .chain_err(|| LEK::FormatError)
- });
- (r, i + 1)
- });
- debug!("Iterated over {} entries", n);
- r
- }
-
-}
-
diff --git a/lib/entry/libimagentrylist/src/listers/line.rs b/lib/entry/libimagentrylist/src/listers/line.rs
deleted file mode 100644
index 10fca9d8..00000000
--- a/lib/entry/libimagentrylist/src/listers/line.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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 std::io::stdout;
-use std::io::Write;
-
-use lister::Lister;
-use error::Result;
-use error::ResultExt;
-
-use libimagstore::store::FileLockEntry;
-
-pub struct LineLister<'a> {
- unknown_output: &'a str,
-}
-
-impl<'a> LineLister<'a> {
-
- pub fn new(unknown_output: &'a str) -> LineLister<'a> {
- LineLister {
- unknown_output: unknown_output,
- }
- }
-
-}
-
-impl<'a> Lister for LineLister<'a> {
-
- fn list<'b, I: Iterator<Item = FileLockEntry<'b>>>(&self, entries: I) -> Result<()> {
- use error::ListErrorKind as LEK;
-
- for entry in entries {
- let s = entry.get_location().to_str().unwrap_or(String::from(self.unknown_output));
- write!(stdout(), "{:?}\n", s).chain_err(|| LEK::FormatError)?
- }
-
- Ok(())
- }
-
-}
diff --git a/lib/entry/libimagentrylist/src/listers/mod.rs b/lib/entry/libimagentrylist/src/listers/mod.rs
deleted file mode 100644
index bb440662..00000000
--- a/lib/entry/libimagentrylist/src/listers/mod.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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
-//
-
-pub mod core;
-pub mod line;
-pub mod path;
-pub mod table;
diff --git a/lib/entry/libimagentrylist/src/listers/path.rs b/lib/entry/libimagentrylist/src/listers/path.rs
deleted file mode 100644
index 7211812e..00000000
--- a/lib/entry/libimagentrylist/src/listers/path.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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 std::io::stdout;
-use std::io::Write;
-
-use lister::Lister;
-use error::Result;
-use error::ResultExt;
-
-use libimagstore::store::FileLockEntry;
-
-pub struct PathLister {
- absolute: bool,
-}
-
-impl PathLister {
-
- pub fn new(absolute: bool) -> PathLister {
- PathLister {
- absolute: absolute,
- }
- }
-
-}
-
-impl Lister for PathLister {
-
- fn list<'a, I: Iterator<Item = FileLockEntry<'a>>>(&self, entries: I) -> Result<()> {
- use error::ListErrorKind as LEK;
-
- for entry in entries {
- let pb = entry.get_location().clone();
- let pb = pb.into_pathbuf().chain_err(|| LEK::FormatError)?;
- let pb = if self.absolute {
- pb.canonicalize().chain_err(|| LEK::FormatError)?
- } else {
- pb.into()
- };
-
- write!(stdout(), "{:?}\n", pb).chain_err(|| LEK::FormatError)?
- }
-
- Ok(())
- }
-
-}
-
diff --git a/lib/entry/libimagentrylist/src/listers/table.rs b/lib/entry/libimagentrylist/src/listers/table.rs
deleted file mode 100644
index 06d39fd6..00000000
--- a/lib/entry/libimagentrylist/src/listers/table.rs
+++ /dev/null
@@ -1,128 +0,0 @@
-//
-// imag - the personal information management suite for the commandline
-// Copyright (C) 2015-2018 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 std::io::stdout;
-
-use lister::Lister;
-use error::Result;
-use error::ResultExt;
-
-use libimagstore::store::FileLockEntry;
-
-use prettytable::Table;
-use prettytable::cell::Cell;
-use prettytable::row::Row;
-
-pub struct TableLister<F: Fn(&FileLockEntry) -> Vec<String>> {
- line_generator: F,
- header: Option<Vec<String>>,
-
- with_idx: bool,
- print_empty: bool,
-}
-
-impl<F: Fn(&FileLockEntry) -> Vec<String>> TableLister<F> {
-
- pub fn new(gen: F) -> TableLister<F> {
- TableLister {
- line_generator: gen,
- header: None,
- with_idx: true,
- print_empty: false,
- }
- }
-
- pub fn with_header(mut self, hdr: Vec<String>) -> TableLister<F> {
- self.header = Some(hdr);
- self
- }
-
- pub fn with_idx(mut self, b: bool) -> TableLister<F> {
- self.with_idx = b;
- self
- }
-
- pub fn print_empty(mut self, b: bool) -> TableLister<F> {
- self.print_empty = b;
- self
- }
-
-}
-
-impl<F: Fn(&FileLockEntry) -> Vec<String>> Lister for TableLister<F> {
-
- fn list<'b, I: Iterator<Item = FileLockEntry<'b>>>(&self, entries: I) -> Result<()> {
- use error::ListErrorKind as LEK;
- use error::ListError as LE;
-
- let mut table = Table::new();
- let mut header_len : Option<usize> = None;
- match self.header {
- Some(ref s) => {
- debug!("We have a header... preparing");
- let mut cells : Vec<Cell> = s.iter().map(|s| Cell::new(s)).collect();
- if self.with_idx {
- cells.insert(0, Cell::new("#"));
- }
- table.set_titles(Row::new(cells));
- header_len = Some(s.len());
- },
- None => {
- debug!("No header for table found... continuing without");
- },
- }
-
- let mut entries_added = 0;
-
- entries.enumerate().fold(Ok(table), |table, (i, entry)| {
- table.and_then(|mut table| {
- let mut v = (self.line_generator)(&entry);
- {
- let v_len = v.len();
- if header_len.is_none() {
- header_len = Some(v_len);
- }
- if header_len.map(|l| v_len > l).unwrap_or(false) {
- return Err(LE::from_kind(LEK::FormatError));
- }
- while header_len.map(|l| v.len() != l).unwrap_or(false) {
- v.push(String::from(""));
- }
- }
-
- if self.with_idx {
- v.insert(0, format!("{}", i));
- }
-
- table.add_row(v.iter().map(|s| Cell::new(s)).collect());
- entries_added += 1;
- Ok(table)
- })
- })
- .and_then(|tbl| {
- if entries_added != 0 && !self.print_empty {
- let mut io = stdout();
- tbl.print(&mut io).chain_err(|| LEK::IOError)
- } else {
- Ok(())
- }
- })
- }
-
-}