locator

package
v0.0.0-...-291624d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyzedFile

type AnalyzedFile struct {
	FilePath  string
	Content   *os.File
	Locations []Location
	Ok        bool
}

func (*AnalyzedFile) GetInfo

func (f *AnalyzedFile) GetInfo()

Print to stdout the info of the AnalyzedFile e.x

fileName
lineNumber: foundText

type Location

type Location struct {
	LineNo   int
	Contents string
}

type Locator

type Locator struct {
	BaseDir string
	Options OptionConfig
}

func NewLocator

func NewLocator(dir string) *Locator

Initializes a new Locator and returns a pointer to it. Supply "dir" with the desired base directory

func (*Locator) Analyze

func (l *Locator) Analyze(fileName string, text string) AnalyzedFile

Use Analyze to open and scan the given file, fileName, and assert whether it contains the given string, text. If it does it is accumulated to a slice of AnalyzedFile and later returned

func (*Locator) Dig

func (l *Locator) Dig(text string)

Dig recursively searches through a directory and it's files to find the given string "text"

type OptionConfig

type OptionConfig struct {
	Verbose, Hidden bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL