From 9d2e9ea174c35f393609f9f90846247b544fa1cf Mon Sep 17 00:00:00 2001 From: Jakob-Niklas See Date: Thu, 28 Apr 2022 19:54:16 +0200 Subject: Search: Allow specifiying the limited of returned entries (#364) This patch adds a new option to the search command, allowing to limit the returned results from the database. --- src/command/client/search.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/command/client/search.rs b/src/command/client/search.rs index 21f07716..bc778f02 100644 --- a/src/command/client/search.rs +++ b/src/command/client/search.rs @@ -55,6 +55,10 @@ pub struct Cmd { #[clap(long)] after: Option, + /// How many entries to return at most + #[clap(long)] + limit: Option, + /// Open interactive search UI #[clap(long, short)] interactive: bool, @@ -97,6 +101,7 @@ impl Cmd { self.exclude_cwd, self.before, self.after, + self.limit, &self.query, db, ) @@ -589,6 +594,7 @@ async fn run_non_interactive( exclude_cwd: Option, before: Option, after: Option, + limit: Option, query: &[String], db: &mut (impl Database + Send + Sync), ) -> Result<()> { @@ -606,7 +612,7 @@ async fn run_non_interactive( let results = db .search( - None, + limit, settings.search_mode, settings.filter_mode, &context, -- cgit v1.2.3