use kv in cli
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
extern crate clap;
|
extern crate clap;
|
||||||
use clap::{App, Arg, SubCommand};
|
use clap::{App, Arg, SubCommand};
|
||||||
|
use std::path::Path;
|
||||||
use taskwarrior_rust::{taskstorage, Replica, DB};
|
use taskwarrior_rust::{taskstorage, Replica, DB};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
@@ -16,7 +17,12 @@ fn main() {
|
|||||||
.subcommand(SubCommand::with_name("list").about("lists tasks"))
|
.subcommand(SubCommand::with_name("list").about("lists tasks"))
|
||||||
.get_matches();
|
.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() {
|
match matches.subcommand() {
|
||||||
("add", Some(matches)) => {
|
("add", Some(matches)) => {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use uuid::Uuid;
|
|||||||
mod inmemory;
|
mod inmemory;
|
||||||
mod kv;
|
mod kv;
|
||||||
|
|
||||||
|
pub use self::kv::KVStorage;
|
||||||
pub use inmemory::InMemoryStorage;
|
pub use inmemory::InMemoryStorage;
|
||||||
|
|
||||||
/// An in-memory representation of a task as a simple hashmap
|
/// An in-memory representation of a task as a simple hashmap
|
||||||
|
|||||||
Reference in New Issue
Block a user