feat: wiki search using git-grep
+ add release note
This commit is contained in:
parent
d6915f4d5f
commit
ec4f5495ba
10 changed files with 107 additions and 0 deletions
|
@ -27,6 +27,7 @@ type GrepResult struct {
|
|||
type GrepOptions struct {
|
||||
RefName string
|
||||
MaxResultLimit int
|
||||
MatchesPerFile int
|
||||
ContextLineNumber int
|
||||
IsFuzzy bool
|
||||
PathSpec []setting.Glob
|
||||
|
@ -54,6 +55,9 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO
|
|||
var results []*GrepResult
|
||||
cmd := NewCommand(ctx, "grep", "--null", "--break", "--heading", "--fixed-strings", "--line-number", "--ignore-case", "--full-name")
|
||||
cmd.AddOptionValues("--context", fmt.Sprint(opts.ContextLineNumber))
|
||||
if opts.MatchesPerFile > 0 {
|
||||
cmd.AddOptionValues("--max-count", fmt.Sprint(opts.MatchesPerFile))
|
||||
}
|
||||
if opts.IsFuzzy {
|
||||
words := strings.Fields(search)
|
||||
for _, word := range words {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue