summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-todo
diff options
context:
space:
mode:
authorMario Krehl <mario-krehl@gmx.de>2017-09-02 14:34:03 +0200
committerMario Krehl <mario-krehl@gmx.de>2017-09-02 16:12:12 +0200
commit0f317858e274d92469589feaafc8aabe3250705b (patch)
tree8c9980c1204b877d6176b8e68c663c9ab1329d06 /bin/domain/imag-todo
parent58a2729da010b81b7f9894013b867c325f922272 (diff)
Refactor imag-todo to work with the TaskStore trait instead of Task
Diffstat (limited to 'bin/domain/imag-todo')
-rw-r--r--bin/domain/imag-todo/Cargo.toml1
-rw-r--r--bin/domain/imag-todo/src/main.rs10
2 files changed, 4 insertions, 7 deletions
diff --git a/bin/domain/imag-todo/Cargo.toml b/bin/domain/imag-todo/Cargo.toml
index fd77cb99..a2c1503d 100644
--- a/bin/domain/imag-todo/Cargo.toml
+++ b/bin/domain/imag-todo/Cargo.toml
@@ -22,6 +22,5 @@ is-match = "0.1.*"
version = "2.0.1"
libimagrt = { version = "0.4.0", path = "../../../lib/core/libimagrt" }
-libimagstore = { version = "0.4.0", path = "../../../lib/core/libimagstore" }
libimagerror = { version = "0.4.0", path = "../../../lib/core/libimagerror" }
libimagtodo = { version = "0.4.0", path = "../../../lib/domain/libimagtodo" }
diff --git a/bin/domain/imag-todo/src/main.rs b/bin/domain/imag-todo/src/main.rs
index 3254f5c5..dd226a3f 100644
--- a/bin/domain/imag-todo/src/main.rs
+++ b/bin/domain/imag-todo/src/main.rs
@@ -25,7 +25,6 @@ extern crate toml_query;
#[macro_use] extern crate version;
extern crate libimagrt;
-extern crate libimagstore;
extern crate libimagerror;
extern crate libimagtodo;
@@ -36,8 +35,7 @@ use toml::Value;
use libimagrt::runtime::Runtime;
use libimagrt::setup::generate_runtime_setup;
-use libimagstore::store::FileLockEntry;
-use libimagtodo::task::Task;
+use libimagtodo::task::TaskStore;
use libimagerror::trace::{MapErrTrace, trace_error, trace_error_exit};
mod ui;
@@ -65,7 +63,7 @@ fn tw_hook(rt: &Runtime) {
let stdin = stdin();
let stdin = stdin.lock(); // implements BufRead which is required for `FileLockEntry::import_task_from_reader()`
- match FileLockEntry::import_task_from_reader(rt.store(), stdin) {
+ match rt.store().import_task_from_reader(stdin) {
Ok((_, line, uuid)) => println!("{}\nTask {} stored in imag", line, uuid),
Err(e) => trace_error_exit(&e, 1),
}
@@ -73,7 +71,7 @@ fn tw_hook(rt: &Runtime) {
// The used hook is "on-modify". This hook gives two json-objects
// per usage und wants one (the second one) back.
let stdin = stdin();
- FileLockEntry::delete_tasks_by_imports(rt.store(), stdin.lock()).map_err_trace().ok();
+ rt.store().delete_tasks_by_imports(stdin.lock()).map_err_trace().ok();
} else {
// Should not be possible, as one argument is required via
// ArgGroup
@@ -94,7 +92,7 @@ fn list(rt: &Runtime) {
is_match!(e.kind(), &::toml_query::error::ErrorKind::IdentifierNotFoundInDocument(_))
};
- let res = FileLockEntry::all_tasks(rt.store()) // get all tasks
+ let res = rt.store().all_tasks() // get all tasks
.map(|iter| { // and if this succeeded
// filter out the ones were we can read the uuid
let uuids : Vec<_> = iter.filter_map(|storeid| {