Documentation
¶
Index ¶
- func File(filename string, find []byte, ignoreCase bool) (int, []textpos.Match)
- func FileRegexp(filename string, re *regexp.Regexp) (int, []textpos.Match)
- func LangCheck(fi *fileinfo.FileInfo, langs []fileinfo.Known) bool
- func LexItems(src [][]rune, lexs []lexer.Line, find []byte, ignoreCase bool) (int, []textpos.Match)
- func Reader(reader io.Reader, find []byte, ignoreCase bool) (int, []textpos.Match)
- func ReaderRegexp(reader io.Reader, re *regexp.Regexp) (int, []textpos.Match)
- func RuneLines(src [][]rune, find []byte, ignoreCase bool) (int, []textpos.Match)
- func RuneLinesRegexp(src [][]rune, re *regexp.Regexp) (int, []textpos.Match)
- type Results
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func File ¶
File looks for a literal string (no regexp) within a file, in given case-sensitive way, returning number of occurrences and specific match position list. Column positions are in runes.
func FileRegexp ¶
FileRegexp looks for a string using Go regexp expression within a file, returning number of occurrences and specific match position list. Column positions are in runes.
func LangCheck ¶
LangCheck checks if file matches list of target languages: true if matches (or no langs)
func LexItems ¶
LexItems looks for a string (no regexp), as entire lexically tagged items, with given case-sensitivity returning number of occurrences and specific match position list. Column positions are in runes.
func Reader ¶
Reader looks for a literal string (no regexp) from an io.Reader input stream, using given case-sensitivity. Returns number of occurrences and specific match position list. Column positions are in runes.
func ReaderRegexp ¶
ReaderRegexp looks for a string using Go regexp expression, from an io.Reader input stream. Returns number of occurrences and specific match position list. Column positions are in runes.
Types ¶
type Results ¶
Results is used to report search results.
func All ¶
func All(root string, find string, ignoreCase, regExp bool, langs []fileinfo.Known, exclude ...string) ([]Results, error)
All returns list of all files under given root path, in all subdirs, of given language(s) that contain the given string, sorted in descending order by number of occurrences.
- ignoreCase transforms everything into lowercase.
- regExp uses the go regexp syntax for the find string.
- exclude is a list of filenames to exclude.
func Paths ¶
func Paths(paths []string, find string, ignoreCase, regExp bool, langs []fileinfo.Known, exclude ...string) ([]Results, error)
Paths returns list of all files in given list of paths (only: no subdirs), of language(s) that contain the given string, sorted in descending order by number of occurrences. Paths can be relative to current working directory. Automatically skips generated files.
- ignoreCase transforms everything into lowercase.
- regExp uses the go regexp syntax for the find string.
- exclude is a list of filenames to exclude: can use standard Glob patterns.