diff options
-rw-r--r-- | libimagtodo/src/task.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libimagtodo/src/task.rs b/libimagtodo/src/task.rs index 36f4a75d..3459bdfc 100644 --- a/libimagtodo/src/task.rs +++ b/libimagtodo/src/task.rs @@ -59,7 +59,14 @@ impl<'a> Task<'a> { /// /// For an explanation on the return values see `Task::get_from_import()`. pub fn get_from_string(store: &'a Store, s: String) -> Result<RResult<Task<'a>, String>> { - unimplemented!() + import_task(s.as_str()) + .map_err_into(TodoErrorKind::ImportError) + .map(|t| t.uuid().clone()) + .and_then(|uuid| Task::get_from_uuid(store, uuid)) + .and_then(|o| match o { + None => Ok(Err(s)), + Some(t) => Ok(Ok(t)), + }) } /// Get a task from an UUID. |