|
|
|
@ -61,7 +61,7 @@ fn init() -> io::Result<()> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn add(id: &String) -> io::Result<()> { |
|
|
|
|
let db = DB::new(STORAGE_PATH)?; |
|
|
|
|
let mut db = DB::new(STORAGE_PATH)?; |
|
|
|
|
if db.items.contains(id) { |
|
|
|
|
// TODO: ask to edit existing in outer function which invoked this one
|
|
|
|
|
return Err(io::Error::new( |
|
|
|
@ -70,6 +70,7 @@ fn add(id: &String) -> io::Result<()> {
|
|
|
|
|
)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
db.items.insert(id.clone()); |
|
|
|
|
db.dump(STORAGE_PATH)?; |
|
|
|
|
|
|
|
|
|
Ok(()) |
|
|
|
|