diff --git a/src/table.rs b/src/table.rs index 825e70e..315af33 100644 --- a/src/table.rs +++ b/src/table.rs @@ -99,6 +99,13 @@ impl Table { self.rewrite_table()?; Ok(()) } + + pub fn delete_collection(&mut self, name:String) -> Result<(), Box>{ + let selected_row = self.get_row(name.clone()).expect("No collection with that name in table"); + remove_file(&selected_row.path)?; + self.collections.remove(&name); + Ok(()) + } pub fn update(&mut self, name: String, entry: Collection)-> Result<(), Box>{ // TODO: this currently wipes out files and rewrites the entirety of them. Update to only change the sections that need to change.