diff --git a/src/main.rs b/src/main.rs index 926e907..b853aa7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod tui; use std::fs; use std::io::Write; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use anyhow::{ensure, Result}; use clap::{Parser, Subcommand}; @@ -43,6 +43,9 @@ enum Command { /// Add a project Add { path: PathBuf }, + /// Remove a project + Remove { path: PathBuf }, + /// List existing projects List, @@ -93,6 +96,9 @@ fn handle_subcommands(mut projects: Projects, cmd: &Command) -> Result<()> { Command::Add { path } => { add_project(&mut projects, path)?; } + Command::Remove { path } => { + remove_project(&mut projects, path)?; + } Command::List => { list_projects(&projects)?; } @@ -129,6 +135,38 @@ where } +fn remove_project
(projects: &mut Projects, path: P) -> Result<()>
+where
+ P: AsRef