Skip to content

feat(cli): Add -e and --all-match to c grep - #1206

Merged
JeanMertz merged 2 commits into
mainfrom
jp-c-grep-or
Sep 28, 2026
Merged

JeanMertz merged 2 commits into
mainfrom
jp-c-grep-or

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

jp c grep accepts several patterns through a repeatable -e (long form --pattern). A line matches when it contains any of them. Adding --all-match keeps only conversations that contain every pattern. The patterns can match in any order, on different lines, and in different turns and scopes:

jp c grep --all-match -e httpmock -e openrouter

Every line matching any pattern is shown and highlighted, so the output shows where each term occurs. A single regex can't express this, because matching runs one line at a time.

--regex applies to every pattern. Smart-case is decided per pattern, so -e wasm -e Rust only makes Rust case-sensitive. --max-matches and --quiet still limit what is printed, but under --all-match the search keeps reading until every pattern has been found, so a conversation is never rejected because the cap was reached early.

-e can't be combined with the positional pattern, and --all-match requires -e. Without that rule, jp c grep --all-match alpha beta would quietly search for the phrase alpha beta. The positional multi-word pattern works as before.

`jp c grep` accepts several patterns through a repeatable `-e` (long
form `--pattern`). A line matches when it contains any of them. Adding
`--all-match` keeps only conversations that contain every pattern. The
patterns can match in any order, on different lines, and in different
turns and scopes:

    jp c grep --all-match -e httpmock -e openrouter

Every line matching any pattern is shown and highlighted, so the output
shows where each term occurs. A single regex can't express this,
because matching runs one line at a time.

`--regex` applies to every pattern. Smart-case is decided per pattern,
so `-e wasm -e Rust` only makes `Rust` case-sensitive.
`--max-matches` and `--quiet` still limit what is printed, but under
`--all-match` the search keeps reading until every pattern has been
found, so a conversation is never rejected because the cap was reached
early.

`-e` can't be combined with the positional pattern, and `--all-match`
requires `-e`. Without that rule, `jp c grep --all-match alpha beta`
would quietly search for the phrase `alpha beta`. The positional
multi-word pattern works as before.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz
JeanMertz merged commit ab6df49 into main Sep 28, 2026
22 checks passed
@JeanMertz
JeanMertz deleted the jp-c-grep-or branch September 28, 2026 20:51
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