use kv in cli

This commit is contained in:
Dustin J. Mitchell
2020-01-12 13:51:58 -05:00
parent 4172c7012c
commit f8977c9ce3
2 changed files with 8 additions and 1 deletions

View File

@@ -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)) => {

View File

@@ -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