summaryrefslogtreecommitdiffstats
path: root/libimagtodo
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-06 20:08:50 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-21 17:14:11 +0200
commitdf5abef44795ee4c6710232909ef1f2e98b87083 (patch)
tree9689ec195ad1b56b313e3b203881da9856956a88 /libimagtodo
parent07ab966d3797ad4d98898f087024d5039b5f6bf7 (diff)
Move delete functionality to the place where it belongs
Diffstat (limited to 'libimagtodo')
-rw-r--r--libimagtodo/src/delete.rs19
-rw-r--r--libimagtodo/src/lib.rs1
-rw-r--r--libimagtodo/src/task.rs6
3 files changed, 6 insertions, 20 deletions
diff --git a/libimagtodo/src/delete.rs b/libimagtodo/src/delete.rs
deleted file mode 100644
index ed56dc0c..00000000
--- a/libimagtodo/src/delete.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use uuid::Uuid;
-
-use libimagstore::store::Store;
-use libimagstore::storeid::IntoStoreId;
-use module_path::ModuleEntryPath;
-
-use error::{TodoError, TodoErrorKind};
-
-/// With the uuid we get the storeid and then we can delete the entry
-pub fn delete(store : &Store, uuid: Uuid) -> Result<(),TodoError> {
- // With the uuid we get the storeid
- let store_id = ModuleEntryPath::new(format!("taskwarrior/{}", uuid)).into_storeid();
- // It deletes an entry
- match store.delete(store_id) {
- Ok(val) => Ok(val),
- Err(e) => Err(TodoError::new(TodoErrorKind::StoreError, Some(Box::new(e)))),
- }
-}
-
diff --git a/libimagtodo/src/lib.rs b/libimagtodo/src/lib.rs
index 0396704a..cf1f966c 100644
--- a/libimagtodo/src/lib.rs
+++ b/libimagtodo/src/lib.rs
@@ -7,7 +7,6 @@ extern crate task_hookrs;
module_entry_path_mod!("todo", "0.1.0");
-pub mod delete;
pub mod error;
pub mod read;
pub mod result;
diff --git a/libimagtodo/src/task.rs b/libimagtodo/src/task.rs
index 0c68e4c0..ebfb4b7e 100644
--- a/libimagtodo/src/task.rs
+++ b/libimagtodo/src/task.rs
@@ -2,6 +2,7 @@ use std::collections::BTreeMap;
use std::ops::{Deref, DerefMut};
use toml::Value;
+use uuid::Uuid;
use task_hookrs::task::Task as TTask;
@@ -23,6 +24,11 @@ impl<'a> Task<'a> {
Task(fle)
}
+ pub fn delete_by_uuid(store: &Store, uuid: Uuid) -> Result<()> {
+ store.delete(ModuleEntryPath::new(format!("taskwarrior/{}", uuid)).into_storeid())
+ .map_err(|e| TodoError::new(TodoErrorKind::StoreError, Some(Box::new(e))))
+ }
+
}
impl<'a> Deref for Task<'a> {