Add date filters to zypper search#648
Conversation
|
🤔
|
|
Time ranges are currently supported by combining the zypper search --build-after 2024-01-01 --build-before 2024-12-31 foo
zypper search --install-after 2024-01-01 --install-before 2024-12-31 --installed-only fooFor this first implementation I intentionally limited the accepted input to calendar dates in YYYY-MM-DD format. My idea was to keep the initial scope small and predictable, and avoid adding a more complex relative-time parser in the first PR. Support for relative units such as days, weeks, or months could be added later if maintainers think that is useful, for example with options like --build-within 30d or similar. |
|
How do you think about to experiment with an other filter parameter style? 🤔 |
|
Thanks for the suggestion. I think an expression-style filter syntax could be interesting, especially if For this PR, though, I would prefer to keep the interface based on explicit command-line options, for example: zypper search --install-after 2024-01-01 --install-before 2024-12-31 fooThe reasons are:
Relative dates such as yesterday could be useful, but I think they should probably be considered separately from this first version. |
There was a problem hiding this comment.
Pull request overview
Adds date-based filtering to zypper search so users can restrict results by build date and/or install date, addressing #575.
Changes:
- Introduces new
zypper searchflags:--build-after/--build-before/--install-after/--install-before. - Adds ISO date parsing/validation for CLI input and stores date ranges on
SearchCmd. - Filters query results via a new
matchesDateFilters(...)helper across the relevant output paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/commands/search/search.h | Adds DateRange state to SearchCmd and declares date-filter helper methods. |
| src/commands/search/search.cc | Implements date parsing, new CLI options, and applies date filtering to search results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
All the Copilot revisions fixed! |
Fixes #575
Summary
Adds date-based filters to
zypper search:--build-after YYYY-MM-DD--build-before YYYY-MM-DD--install-after YYYY-MM-DD--install-before YYYY-MM-DDValidation
Built successfully in an openSUSE Tumbleweed container using:
Manually validated:
Notes
This PR intentionally limits the initial scope to filtering results only. It does not add new table columns or XML output fields, keeping the change small and easier to review.