Skip to content

feat(search): allow repeated exit-code filters - #4132

Merged
markovejnovic merged 1 commit into
atuinsh:mainfrom
pederbe:learn/2701-repeat-exit-filters
Sep 14, 2026
Merged

markovejnovic merged 1 commit into
atuinsh:mainfrom
pederbe:learn/2701-repeat-exit-filters

Conversation

@pederbe

@pederbe pederbe commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Problem

The CLI's --exit / --exclude-exit flags only accepted a single value each, unlike author/shell, which already supported repeats. Sqlite::search could apply one equality and one inequality but nothing more.

Change

  • Changed exit / exclude_exit from Option<i64> to Vec<i64> in the CLI, matching the author/shell pattern. --exit 1 --exit 2 now matches either code; repeated --exclude-exit removes every listed code.
  • Changed OptFilters to take borrowed &[i64] slices for these fields, with an empty slice meaning no restriction. Borrowing keeps OptFilters Copy and works with the deletion loop that reuses the same filters.
  • The database builds one IN predicate for non-empty exit lists and one NOT IN for exclusions. Both combine with AND alongside the existing filters. Exclusions win over overlapping inclusions; duplicates are harmless.

Closes #2701

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

@pederbe
pederbe marked this pull request as ready for review September 13, 2026 12:05
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds repeatable exit-code inclusion and exclusion filters to CLI history search.

  • Represents exit filters as borrowed slices.
  • Applies IN and NOT IN predicates before deduplication and limits.
  • Adds CLI/database coverage and updates search documentation.

Confidence Score: 5/5

The PR appears safe to merge.

The repeated options are parsed correctly, generate safe integer-only predicates, and preserve filtering order across search and deletion paths.

Important Files Changed

Filename Overview
crates/atuin-client/src/database.rs Implements multi-value exit predicates with broad search and deletion tests.
crates/atuin/src/command/client/search.rs Accepts repeated exit-filter arguments and passes them to database search.
docs/docs/reference/search.md Documents repeated inclusion/exclusion flags and their combined behavior.

Reviews (1): Last reviewed commit: "feat(search): allow repeated exit-code f..." | Re-trigger Greptile

@markovejnovic

Copy link
Copy Markdown
Member

LGTM! Thank you!

@markovejnovic
markovejnovic merged commit 50fcb6a into atuinsh:main Sep 14, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing --exit and --exclude-exit multiple times

2 participants