diff options
| author | Tom Cammann <tom.cammann@oracle.com> | 2023-03-29 09:27:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-29 09:27:14 +0100 |
| commit | fa0a1447a60a854f2997c9e1b9fd87bca871b1d9 (patch) | |
| tree | 64b22e99581aa72af86d0423897715f80ffd61f6 /atuin-client/src/database.rs | |
| parent | install.sh - add endeavouros to archlinux detection (#827) (diff) | |
| download | atuin-fa0a1447a60a854f2997c9e1b9fd87bca871b1d9.zip | |
Add `--offset` flag to `atuin search` (#825)
This flag allows the user to continue searching at an offset. This is
useful for building tools that use atuin to search for previous
commands and return only one result.
```
atuin search --limit 1
atuin search --limit 1 --offset 1
atuin search --limit 1 --offset 2
```
Diffstat (limited to 'atuin-client/src/database.rs')
| -rw-r--r-- | atuin-client/src/database.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 1a577a70..6d364dbe 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -34,6 +34,7 @@ pub struct OptFilters { pub before: Option<String>, pub after: Option<String>, pub limit: Option<i64>, + pub offset: Option<i64>, } pub fn current_context() -> Context { @@ -361,6 +362,10 @@ impl Database for Sqlite { sql.limit(limit); } + if let Some(offset) = filter_options.offset { + sql.offset(offset); + } + match filter { FilterMode::Global => &mut sql, FilterMode::Host => sql.and_where_eq("hostname", quote(&context.hostname)), |
