feat: allow regex search

Signed-off-by: jolheiser <git@jolheiser.com>
main
jolheiser 2024-08-10 12:16:19 -05:00
parent 00b0d91307
commit 11d534f89f
No known key found for this signature in database
1 changed files with 4 additions and 2 deletions

View File

@ -18,8 +18,10 @@ type GrepResult struct {
// Grep performs a naive "code search" via git grep
func (r Repo) Grep(search string) ([]GrepResult, error) {
// Plain-text search only
re, err := regexp.Compile(regexp.QuoteMeta(search))
if strings.HasPrefix(search, "=") {
search = regexp.QuoteMeta(strings.TrimPrefix(search, "="))
}
re, err := regexp.Compile(search)
if err != nil {
return nil, err
}