filter

package
v0.0.0-...-63c3a42 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	FilterLines []string
	// contains filtered or unexported fields
}

A Filter contains a list of regular expressions matching pathnames which should be filtered out: excluded when building or not changed when pushing images to a sub. A Filter with no lines is an empty filter (nothing is excluded, everything is changed when pushing). A nil *Filter is a sparse filter: when building nothing is excluded. When pushing to a sub, all files are pushed but files on the sub which are not in the image are not removed from the sub.

func Load

func Load(filename string) (*Filter, error)

Load will load a Filter from a file containing newline separated regular expressions.

func New

func New(filterLines []string) (*Filter, error)

New will create a Filter from a list of regular expressions, which are automatically anchored to the beginning of the string to be matched against. If filterLines is of length zero the Filter is an empty Filter.

func Read

func Read(reader io.Reader) (*Filter, error)

Read will read a Filter from a reader containing newline separated regular expressions.

func (*Filter) Compile

func (filter *Filter) Compile() error

Compile will compile the regular expression strings for later use.

func (*Filter) Match

func (filter *Filter) Match(pathname string) bool

Match will return true if pathname matches one of the regular expressions. The Compile method will be automatically called if it has not been called yet.

func (*Filter) ReplaceStrings

func (filter *Filter) ReplaceStrings(replaceFunc func(string) string)

ReplaceStrings may be used to replace the regular expression strings with de-duplicated copies.

type MergeableFilter

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

A MergeableFilter may be used to combine multiple Filters, eliminating duplicate match expressions.

func (*MergeableFilter) ExportFilter

func (mf *MergeableFilter) ExportFilter() *Filter

ExportFilter will return a Filter from previously merged Filters.

func (*MergeableFilter) Merge

func (mf *MergeableFilter) Merge(filter *Filter)

Merge will merge a Filter.

Jump to

Keyboard shortcuts

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