file

package
v0.0.0-...-a7a0a81 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(slug string, constructor MatcherConstructor) error

Register adds a matcher to the registry.

Types

type Feeder

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

Feeder feeds files.

func NewFeeder

func NewFeeder(matchers ...Matcher) *Feeder

NewFeeder creates a new Feeder that feeds files accepted by all `matchers`.

func (*Feeder) Feed

func (f *Feeder) Feed(root string) (<-chan string, error)

Feed feeds all files starting from a `root` directory to a chan of paths. If the error return value is not nil then the chan return value is nil.

type GlobMatcherConfig

type GlobMatcherConfig struct {

	// Pattern is the glob pattern used by the matcher.
	Pattern string `yaml:"pattern"`
}

GlobMatcherConfig describes the configuration of a GlobMatcher.

type Matcher

type Matcher interface {

	// Matches matches a file based on path.
	Matches(path string) bool
}

Matcher matches a file based on a path criteria.

func Get

func Get(slug string, config interface{}) Matcher

Get returns the Matcher referenced by a `slug`.

func GlobMatcher

func GlobMatcher(configData interface{}) Matcher

GlobMatcher creates a new Matcher that accepts files based on glob pattern.

func NotMatcher

func NotMatcher(configData interface{}) Matcher

NotMatcher creates a new Matcher that reverses the decision of matcher.

type MatcherConstructor

type MatcherConstructor func(configData interface{}) Matcher

MatcherConstructor constructs Matcher instances.

type NotMatcherConfig

type NotMatcherConfig struct {

	// Type is the type of the negated matcher.
	Type string `yaml:"type"`

	// Config is the configuration of the negated matcher.
	Config interface{} `yaml:"config"`
}

NotMatcherConfig describes the configuration of a NotMatcher.

Jump to

Keyboard shortcuts

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