From 18d46f7a8550fd0773df6ca838a0caf6f4b657c4 Mon Sep 17 00:00:00 2001 From: jvech Date: Tue, 9 Jul 2024 11:43:29 -0500 Subject: add: note filter implemented --- src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 8a4f338..c4acc8b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use xdg; -use rusqlite::Result; +use rusqlite::{Result, Connection}; mod database; mod cli; @@ -27,13 +27,14 @@ fn main() -> Result<()> { register.add_register(&datapath)?; }, - Commands::View {history, filter, total} => { + Commands::View {agent, filter_note, history, total} => { let datapath = cli.database_path.expect("database path not found"); + let conn = Connection::open(&datapath)?; match (history, total) { - (true, false) => Database::view_history(&datapath, filter)?, - (false, true) => Database::view_total(&datapath)?, - (false, false) => Database::view_total(&datapath)?, + (true, false) => Database::view_history(conn, agent, filter_note)?, + (false, true) => Database::view_total(conn)?, + (false, false) => Database::view_total(conn)?, (true, true) => unreachable!() } }, -- cgit v1.2.3-70-g09d2