fix(grep): skip redundant header on single-match results by guyoron1 · Pull Request #2619 · rtk-ai/rtk · GitHub
Skip to content

fix(grep): skip redundant header on single-match results#2619

Open
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/grep-single-match-header
Open

fix(grep): skip redundant header on single-match results#2619
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/grep-single-match-header

Conversation

@guyoron1

Copy link
Copy Markdown

Summary

Fixes #2608rtk grep emitted a redundant "N matches in M files:" header even for single-match results.

  • Header is now suppressed when there is exactly 1 match in 1 file (saves tokens)
  • Fixed grammar: "1 matches in 1 files""1 match in 1 file" for all remaining cases
  • Multi-match and multi-file results continue to show the header with correct pluralization

Before / After

Scenario Before After
1 match, 1 file 1 matches in 1 files:\n\nsrc/main.rs:42:... src/main.rs:42:...
3 matches, 1 file 3 matches in 1 files:\n\n... 3 matches in 1 file:\n\n...
2 matches, 2 files 2 matches in 2 files:\n\n... 2 matches in 2 files:\n\n... (unchanged)

Test plan

  • cargo fmt --all passes
  • cargo clippy --all-targets passes (zero warnings)
  • cargo test --all passes (all tests)

The summary header "N matches in M files:" was always emitted, even
for single-match results where it adds no value and wastes tokens.
Now the header is suppressed when there is exactly 1 match in 1 file.
Also fixes grammar: "1 matches" → "1 match", "1 files" → "1 file".

Closes rtk-ai#2608
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.

grep: spurious "N matches in M files" header on single-match results when the file path is long

1 participant