add a simple CLI
This commit is contained in:
@@ -6,7 +6,7 @@ use std::collections::HashMap;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// A replica represents an instance of a user's task data.
|
||||
struct Replica {
|
||||
pub struct Replica {
|
||||
taskdb: Box<DB>,
|
||||
}
|
||||
|
||||
@@ -46,6 +46,11 @@ impl Replica {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get all tasks as an iterator of (&Uuid, &HashMap)
|
||||
pub fn all_tasks(&self) -> impl Iterator<Item = (&Uuid, &HashMap<String, String>)> {
|
||||
self.taskdb.tasks().iter()
|
||||
}
|
||||
|
||||
/// Get an existing task by its UUID
|
||||
pub fn get_task(&self, uuid: &Uuid) -> Option<&HashMap<String, String>> {
|
||||
self.taskdb.tasks().get(&uuid)
|
||||
|
||||
Reference in New Issue
Block a user