From 4b14f87cc80e7cfb78480644281022296973bc66 Mon Sep 17 00:00:00 2001 From: jvech Date: Wed, 19 Jun 2024 09:15:10 -0500 Subject: feat: agent deletion and name update done --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index be23ac3..8a4f338 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,6 +26,7 @@ fn main() -> Result<()> { let datapath = cli.database_path.unwrap(); register.add_register(&datapath)?; }, + Commands::View {history, filter, total} => { let datapath = cli.database_path.expect("database path not found"); @@ -37,10 +38,17 @@ fn main() -> Result<()> { } }, - Commands::Add {name} => { + Commands::Agent {name, add, delete, update} => { let register = Database::new(name, 0, None, false); let datapath = cli.database_path.unwrap(); - register.add_agent(&datapath)?; + + match (add, delete, update) { + (true, false, None) => register.add_agent(&datapath)?, + (false, true, None) => register.delete_agent(&datapath)?, + (false, false, None) => register.add_agent(&datapath)?, + (false, false, Some(new_name)) => register.update_agent(&datapath, new_name)?, + (_, _, _) => unreachable!() + } } }; Ok(()) -- cgit v1.2.3-70-g09d2