From f8977c9ce3da755e047a934ec3650c3023a21a46 Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 12 Jan 2020 13:51:58 -0500 Subject: [PATCH] use kv in cli --- src/bin/task.rs | 8 +++++++- src/taskstorage/mod.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bin/task.rs b/src/bin/task.rs index d9ce502e2..d692cf384 100644 --- a/src/bin/task.rs +++ b/src/bin/task.rs @@ -1,5 +1,6 @@ extern crate clap; use clap::{App, Arg, SubCommand}; +use std::path::Path; use taskwarrior_rust::{taskstorage, Replica, DB}; use uuid::Uuid; @@ -16,7 +17,12 @@ fn main() { .subcommand(SubCommand::with_name("list").about("lists tasks")) .get_matches(); - let mut replica = Replica::new(DB::new(Box::new(taskstorage::InMemoryStorage::new())).into()); + let mut replica = Replica::new( + DB::new(Box::new( + taskstorage::KVStorage::new(Path::new("/tmp/tasks")).unwrap(), + )) + .into(), + ); match matches.subcommand() { ("add", Some(matches)) => { diff --git a/src/taskstorage/mod.rs b/src/taskstorage/mod.rs index 60541cfa8..092707225 100644 --- a/src/taskstorage/mod.rs +++ b/src/taskstorage/mod.rs @@ -6,6 +6,7 @@ use uuid::Uuid; mod inmemory; mod kv; +pub use self::kv::KVStorage; pub use inmemory::InMemoryStorage; /// An in-memory representation of a task as a simple hashmap