Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Patterns = Registry{
portname,
maintainer,
allDepends,
buildDepends,
libDepends,
runDepends,
testDepends,
onlyForArchs,
uses,
plist,
broken,
}
var Stop = errors.New("stop")
Stop is a special value that can be returned by GrepFunc to indicate that search needs to be terminated early.
Functions ¶
func Grep ¶
func Grep(portsRoot string, categories []string, rxs []*Regexp, rxsOred, rxsAll bool, gfn GrepFunc, maxJobs int) error
Grep searches port Makefiles, looking for matches described by rxs. It starts looking for Makefiles in root directory, and descends up to two levels down (category/port). If cats slice is not empty, Grep descends only to categories listed in cats. By default, multiple regular expressions in rxs are AND-ed together, this can be changed by setting rxsOred to true. By default, only the first match per Makefile is returned; set rxsAll to emit every non-overlapping match. The search will be run by using up to jobs goroutines, the usual practice is to set this to runtime.GOMAXPROCS(0) for the best results.
Types ¶
type GrepFunc ¶
GrepFunc is called for each found match and will be passed the path where match was found and a slice of match results. A Special error value Stop can be returned to terminate search early.
type Result ¶
type Result struct {
// Text holds the match as a byte slice
Text []byte
// QuerySubmatch is a byte index pair identifying the query submatch in Text
QuerySubmatch []int
// QuerySubmatch is a byte index pair identifying the result submatch in Text
ResultSubmatch []int
}
Result describes one search match result.