From 10f465da8ff113819d435b0f8e5066783c5100af Mon Sep 17 00:00:00 2001 From: Peter Holloway Date: Fri, 19 Jan 2024 11:21:05 +0000 Subject: fix: Use existing db querying for history list (#1589) When printing the history list with either the session or cwd filter enabled, use to same query method as without either to ensure that the other options (hide deleted entries etc) are respected. --- atuin-client/src/database.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'atuin-client/src') diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index a6957093..05ff559a 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -78,7 +78,7 @@ pub trait Database: Send + Sync + 'static { async fn load(&self, id: &str) -> Result>; async fn list( &self, - filter: FilterMode, + filters: &[FilterMode], context: &Context, max: Option, unique: bool, @@ -271,7 +271,7 @@ impl Database for Sqlite { // make a unique list, that only shows the *newest* version of things async fn list( &self, - filter: FilterMode, + filters: &[FilterMode], context: &Context, max: Option, unique: bool, @@ -291,13 +291,15 @@ impl Database for Sqlite { context.cwd.clone() }; - match filter { - FilterMode::Global => &mut query, - FilterMode::Host => query.and_where_eq("hostname", quote(&context.hostname)), - FilterMode::Session => query.and_where_eq("session", quote(&context.session)), - FilterMode::Directory => query.and_where_eq("cwd", quote(&context.cwd)), - FilterMode::Workspace => query.and_where_like_left("cwd", git_root), - }; + for filter in filters { + match filter { + FilterMode::Global => &mut query, + FilterMode::Host => query.and_where_eq("hostname", quote(&context.hostname)), + FilterMode::Session => query.and_where_eq("session", quote(&context.session)), + FilterMode::Directory => query.and_where_eq("cwd", quote(&context.cwd)), + FilterMode::Workspace => query.and_where_like_left("cwd", &git_root), + }; + } if unique { query.and_where_eq( -- cgit v1.3.1