mirror of
https://github.com/atuinsh/atuin.git
synced 2024-12-26 08:59:21 +01:00
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.
This commit is contained in:
parent
93ab4e7842
commit
9d2e9ea174
@ -55,6 +55,10 @@ pub struct Cmd {
|
|||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
after: Option<String>,
|
after: Option<String>,
|
||||||
|
|
||||||
|
/// How many entries to return at most
|
||||||
|
#[clap(long)]
|
||||||
|
limit: Option<i64>,
|
||||||
|
|
||||||
/// Open interactive search UI
|
/// Open interactive search UI
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
interactive: bool,
|
interactive: bool,
|
||||||
@ -97,6 +101,7 @@ impl Cmd {
|
|||||||
self.exclude_cwd,
|
self.exclude_cwd,
|
||||||
self.before,
|
self.before,
|
||||||
self.after,
|
self.after,
|
||||||
|
self.limit,
|
||||||
&self.query,
|
&self.query,
|
||||||
db,
|
db,
|
||||||
)
|
)
|
||||||
@ -589,6 +594,7 @@ async fn run_non_interactive(
|
|||||||
exclude_cwd: Option<String>,
|
exclude_cwd: Option<String>,
|
||||||
before: Option<String>,
|
before: Option<String>,
|
||||||
after: Option<String>,
|
after: Option<String>,
|
||||||
|
limit: Option<i64>,
|
||||||
query: &[String],
|
query: &[String],
|
||||||
db: &mut (impl Database + Send + Sync),
|
db: &mut (impl Database + Send + Sync),
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
@ -606,7 +612,7 @@ async fn run_non_interactive(
|
|||||||
|
|
||||||
let results = db
|
let results = db
|
||||||
.search(
|
.search(
|
||||||
None,
|
limit,
|
||||||
settings.search_mode,
|
settings.search_mode,
|
||||||
settings.filter_mode,
|
settings.filter_mode,
|
||||||
&context,
|
&context,
|
||||||
|
Loading…
Reference in New Issue
Block a user