pattern

package
v0.0.0-...-841f565 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher struct {
	Paths            []string
	Includes         []string
	Excludes         []string
	CompiledIncludes []glob.Glob
	CompiledExcludes []glob.Glob
}

Matcher uses patterns to filter files

func (*Matcher) Check

func (m *Matcher) Check(path string) bool

Check returns true if the string is included and not excluded from the matcher

func (*Matcher) Compile

func (m *Matcher) Compile() error

Compile creates globs for each include/exclude pattern provided

func (*Matcher) Excluded

func (m *Matcher) Excluded(path string) bool

Excluded checks if a file matches any of the exclusion patterns

func (*Matcher) HasPrefix

func (m *Matcher) HasPrefix(path string) bool

HasPrefix checks if a file matches any of the provides paths

func (*Matcher) Included

func (m *Matcher) Included(path string) bool

Included checks if a file matches an inclusion pattern

func (*Matcher) MustCompile

func (m *Matcher) MustCompile()

MustCompile is like Compile but panics if the provided expressions cannot be parsed. It simplifies safe initialization of global variables holding compiled regular expressions.

func (*Matcher) Some

func (m *Matcher) Some(paths []string) bool

Some uses Check to validate that at least one of the strings in the provided paths match

func (*Matcher) Walk deprecated

func (m *Matcher) Walk(files []string) ([]string, map[string]bool, error)

Deprecated: Walk walks the specified files to determine matches against it's declared patterns. If files provided contain directories it will traverse all files and sub directories. The files viewed in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.

Jump to

Keyboard shortcuts

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