aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
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(())
Feel free to download, copy and edit any repo