Refactor find command output to ripgrep-style format with colors#4
Merged
feds01 merged 4 commits intofeds01:mainfrom Nov 1, 2025
Merged
Conversation
feds01
reviewed
Oct 31, 2025
Owner
feds01
left a comment
There was a problem hiding this comment.
Thank you for the contribution ❤️ I think this is a nice improvement over the existing display of results. Happy to accept this, I've left a couple of nits on the PR. Once addresses, I think this can go in!
| /// Get the line number (1-indexed) and byte range for a given byte position. | ||
| /// | ||
| /// Returns a tuple of (line_number, line_start_byte, line_end_byte) where line_number is 1-indexed. | ||
| fn get_line_range(contents: &str, byte_pos: usize) -> (usize, usize, usize) { |
Owner
There was a problem hiding this comment.
I think we can move this into crates/teamsearch_utils/src/lines.rs
| let mut message = Level::Info.title("match found"); | ||
|
|
||
| // Now, construct the reports so that we can emit them to the user. | ||
| use colored::Colorize; |
Owner
There was a problem hiding this comment.
This should be at the crate level.
|
|
||
| /// Highlight matches in a line of text. | ||
| fn highlight_line_matches(line_content: &str, matches: &[Match]) -> String { | ||
| use colored::Colorize; |
| } | ||
|
|
||
| /// Highlight matches in a line of text. | ||
| fn highlight_line_matches(line_content: &str, matches: &[Match]) -> String { |
Introduce a new function `get_line_range` in the `teamsearch_utils` crate for parsing line numbers and byte ranges from a string, given a byte position.
a9eeb18 to
f7cc233
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the
findcommand output to match ripgrep's familiar format, making results more compact.Changes
Before
After