ignore

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MPL-2.0 Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsParseError added in v1.8.0

func IsParseError(err error) bool

func WriteIgnores added in v0.14.28

func WriteIgnores(filesystem fs.Filesystem, path string, content []string) error

WriteIgnores is a convenience function to avoid code duplication

Types

type ChangeDetector added in v0.14.31

type ChangeDetector interface {
	Remember(fs fs.Filesystem, name string, modtime time.Time)
	Seen(fs fs.Filesystem, name string) bool
	Changed() bool
	Reset()
}

The ChangeDetector is responsible for determining if files have changed on disk. It gets told to Remember() files (name and modtime) and will then get asked if a file has been Seen() (i.e., Remember() has been called on it) and if any of the files have Changed(). To forget all files, call Reset().

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

func New

func New(fs fs.Filesystem, opts ...Option) *Matcher

func (*Matcher) Hash

func (m *Matcher) Hash() string

func (*Matcher) Lines added in v0.14.28

func (m *Matcher) Lines() []string

Lines return a list of the unprocessed lines in .stignore at last load

func (*Matcher) Load

func (m *Matcher) Load(file string) error

Load and parse a file. The returned error may be of type *ParseError in which case a file was loaded from disk but the patterns could not be parsed. In this case the contents of the file are nonetheless available in the Lines() method.

func (*Matcher) Match

func (m *Matcher) Match(file string) (result Result)

func (*Matcher) Parse

func (m *Matcher) Parse(r io.Reader, file string) error

Load and parse an io.Reader. See Load() for notes on the returned error.

func (*Matcher) Patterns

func (m *Matcher) Patterns() []string

Patterns return a list of the loaded patterns, as they've been parsed

func (*Matcher) ShouldIgnore added in v0.14.20

func (m *Matcher) ShouldIgnore(filename string) bool

ShouldIgnore returns true when a file is temporary, internal or ignored

func (*Matcher) SkipIgnoredDirs added in v0.14.49

func (m *Matcher) SkipIgnoredDirs() bool

func (*Matcher) Stop

func (m *Matcher) Stop()

func (*Matcher) String added in v0.14.47

func (m *Matcher) String() string

type Option added in v0.14.31

type Option func(*Matcher)

An Option can be passed to New()

func WithCache added in v0.14.31

func WithCache(v bool) Option

WithCache enables or disables lookup caching. The default is disabled.

func WithChangeDetector added in v0.14.31

func WithChangeDetector(cd ChangeDetector) Option

WithChangeDetector sets a custom ChangeDetector. The default is to simply use the on disk modtime for comparison.

type ParseError added in v1.8.0

type ParseError struct {
	// contains filtered or unexported fields
}

A ParseError signifies an error with contents of an ignore file, including I/O errors on included files. An I/O error on the root level ignore file is not a ParseError.

func (*ParseError) Error added in v1.8.0

func (e *ParseError) Error() string

func (*ParseError) Unwrap added in v1.8.0

func (e *ParseError) Unwrap() error

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

func (Pattern) String

func (p Pattern) String() string

type Result added in v0.13.0

type Result uint8

func (Result) IsCaseFolded added in v0.13.0

func (r Result) IsCaseFolded() bool

func (Result) IsDeletable added in v0.13.0

func (r Result) IsDeletable() bool

func (Result) IsIgnored added in v0.13.0

func (r Result) IsIgnored() bool

Jump to

Keyboard shortcuts

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