Skip to content

Conversation

@selfup
Copy link
Owner

@selfup selfup commented Aug 16, 2025

What does this PR do?

This adds useful line and col information to filepath output if needed for keywords given.

Passing -l appends :line_number:keyword to the end of file paths

Passing -c appends :line_number:col_number:keyword to the end of file paths

If a single file has many results, each result will be added.

This will help tools/humans/LLMs when searching large files.

Keywords with line numbers

$ scnnr -d . -e .md,.go -k fileData,cache -l
scnnr_bins/README.md:117:cache
scnnr_bins/README.md:122:cache
scnnr_bins/README.md:129:cache
scnnr_bins/README.md:135:fileData
scnnr_bins/README.md:135:cache
README.md:123:cache
README.md:128:cache
README.md:135:cache
README.md:141:fileData
README.md:141:cache
scnnr_bins/README.md:377:cache
scnnr_bins/README.md:387:cache
README.md:383:cache
README.md:393:cache
pkg/scanner.go:215:fileData
pkg/scanner.go:222:fileData

Keywords with both line numbers and column numbers

$ scnnr -d . -e .md,.go -k fileData,cache -c
scnnr_bins/README.md:117:53:cache
scnnr_bins/README.md:122:29:cache
scnnr_bins/README.md:129:22:cache
scnnr_bins/README.md:135:28:fileData
scnnr_bins/README.md:135:37:cache
scnnr_bins/README.md:377:36:cache
scnnr_bins/README.md:387:40:cache
pkg/scanner.go:215:9:fileData
pkg/scanner.go:222:26:fileData
README.md:123:53:cache
README.md:128:29:cache
README.md:135:22:cache
README.md:141:28:fileData
README.md:141:37:cache
README.md:383:36:cache
README.md:393:40:cache
image

@selfup
Copy link
Owner Author

selfup commented Aug 16, 2025

image

@selfup selfup merged commit 0e6f8c3 into master Aug 16, 2025
1 check passed
@selfup selfup deleted the line_and_col branch August 16, 2025 04:16
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