diff options
author | jvech <jmvalenciae@unal.edu.co> | 2024-06-19 09:15:10 -0500 |
---|---|---|
committer | jvech <jmvalenciae@unal.edu.co> | 2024-06-19 09:15:10 -0500 |
commit | 4b14f87cc80e7cfb78480644281022296973bc66 (patch) | |
tree | 74a2cf5fba8557730837f1d681ea1d203b8775f7 /src/main.rs | |
parent | 821eeb0263725d33cbb5d1a044ca593d5959031f (diff) |
feat: agent deletion and name update done
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 10 insertions, 2 deletions
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(()) |