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 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. The search will be run by using up to jobs goroutines, the usual practice is to set this to runtime.NumCPU() 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 Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
type Registry ¶ added in v1.4.0
type Registry []Pattern
func (Registry) OptionString ¶ added in v1.4.0
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.