Skip to content

Add -v / --invert-match - #3

Merged
Gulliby merged 1 commit into
mainfrom
feature/invert-match
Oct 13, 2026
Merged

Gulliby merged 1 commit into
mainfrom
feature/invert-match

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Before

--grep could only keep the records whose message matches a pattern. There was no way to drop the matching records and keep the rest.

After

-v / --invert-match flips --grep: only records whose message does not match are kept.

logslice app.log --grep Disk -v
2026-10-10 12:00:00 INFO Started
2026-10-10T12:00:00.123 warn Slow response

-v needs --grep (otherwise it exits with status 2 and a clear message). It works with -i, the time bounds, --level and --summary.

How

  • src/logslice/filters.py: matches() takes an invert flag.
  • src/logslice/cli.py: the new option and its validation.
  • README.md: documents the option with an example.
  • tests/test_invert_match.py: 16 new tests (209 pass in total, ruff is clean).

@Gulliby
Gulliby merged commit de66bcd into main Oct 13, 2026
6 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.

1 participant