Documentation ¶
Index ¶
- Constants
- Variables
- func Find(roots []string, pattern *Pattern, out chan *GrepParams, option *Option)
- func Grep(in chan *GrepParams, out chan *PrintParams, option *Option)
- func IdentifyType(path string) int
- func Print(in chan *PrintParams, done chan struct{}, option *Option)
- func Walk(root string, ignores ignoreMatchers, follow, multiFinder bool, walkFn WalkFunc) error
- type Color
- type Decorator
- type FileInfo
- type GrepParams
- type Line
- type Match
- type Option
- type Pattern
- type Plain
- type PlatinumSearcher
- type PrintParams
- type WalkFunc
Constants ¶
View Source
const ( ColorReset = "\x1b[0m\x1b[K" ColorLineNumber = "\x1b[1;33m" /* yellow with black background */ ColorPath = "\x1b[1;32m" /* bold green */ ColorMatch = "\x1b[30;43m" /* black with yellow background */ )
View Source
const ( UNKNOWN = iota ERROR BINARY ASCII UTF8 EUCJP SHIFTJIS )
Variables ¶
View Source
var FileMatchCount, MatchCount uint
View Source
var FilesSearched uint
Functions ¶
func Grep ¶
func Grep(in chan *GrepParams, out chan *PrintParams, option *Option)
func IdentifyType ¶
func Print ¶
func Print(in chan *PrintParams, done chan struct{}, option *Option)
Types ¶
type Decorator ¶ added in v1.7.3
type Decorator interface {
// contains filtered or unexported methods
}
type FileInfo ¶
func (*FileInfo) IsNamedPipe ¶ added in v1.7.8
type GrepParams ¶
type Match ¶
type Match struct { Matched bool *Line Befores []*Line Afters []*Line Col int // contains filtered or unexported fields }
func (*Match) FirstLineNum ¶
func (*Match) LastLineNum ¶
type Option ¶
type Option struct { Color func() `long:"color" description:"Print color codes in results (Enabled by default)"` NoColor func() `long:"nocolor" description:"Don't print color codes in results (Disabled by default)"` ForceColor bool // Force color. Not user option. EnableColor bool // Enable color. Not user option. NoGroup bool `long:"nogroup" description:"Don't print file name at header (Disabled by default)"` Column bool `long:"column" description:"Print column (Disabled by default)"` FilesWithMatches bool `short:"l" long:"files-with-matches" description:"Only print filenames that contain matches"` VcsIgnore []string `long:"vcs-ignore" description:"VCS ignore files" default:".gitignore" default:".hgignore" default:".ptignore"` NoPtIgnore bool `long:"noptignore" description:"Don't use default ($Home/.ptignore) file for ignore patterns"` NoGlobalGitIgnore bool `long:"noglobal-gitignore" description:"Don't use git's global gitignore file for ignore patterns"` SkipVcsIgnore func() `short:"U" long:"skip-vcs-ignores" description:"Don't use VCS ignore file for ignore patterns. Still obey .ptignore"` Hidden bool `short:"H" long:"hidden" description:"Search hidden files and directories"` Ignore []string `long:"ignore" description:"Ignore files/directories matching pattern"` IgnoreCase bool `short:"i" long:"ignore-case" description:"Match case insensitively"` SmartCase bool `short:"S" long:"smart-case" description:"Match case insensitively unless PATTERN contains uppercase characters"` FilesWithRegexp string `short:"g" description:"Print filenames matching PATTERN"` FileSearchRegexp string `short:"G" long:"file-search-regexp" description:"PATTERN Limit search to filenames matching PATTERN"` Depth int `long:"depth" default:"25" default-mask:"-" description:"Search up to NUM directories deep (Default: 25)"` Follow bool `short:"f" long:"follow" description:"Follow symlinks"` After int `short:"A" long:"after" description:"Print lines after match"` Before int `short:"B" long:"before" description:"Print lines before match"` Context int `short:"C" long:"context" description:"Print lines before and after match"` OutputEncode string `short:"o" long:"output-encode" description:"Specify output encoding (none, jis, sjis, euc)"` SearchStream bool // Input from pipe. Not user option. Regexp bool `` /* 173-byte string literal not displayed */ WordRegexp bool `short:"w" long:"word-regexp" description:"Only match whole words"` Proc int // Number of goroutine. Not user option. Count bool `short:"c" long:"count" description:"Only print the number of matches in each file."` Stats bool `long:"stats" description:"Print stats about files scanned, time taken, etc"` Parallel bool `long:"parallel" description:"Use as many concurrent finders as possible, this will lead the result disorder"` Version bool `long:"version" description:"Show version"` // contains filtered or unexported fields }
func (*Option) SetDisableColor ¶
func (o *Option) SetDisableColor()
func (*Option) SetEnableColor ¶
func (o *Option) SetEnableColor()
func (*Option) SkipVcsIgnores ¶ added in v1.7.3
func (o *Option) SkipVcsIgnores()
func (*Option) VcsIgnores ¶
type Pattern ¶
type PlatinumSearcher ¶
func (*PlatinumSearcher) Search ¶
func (p *PlatinumSearcher) Search() error
type PrintParams ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.