Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListFiles ¶
ListFiles returns the files in the provided directory (relative or absolute path) that match the provided include matcher but do not match the exclude matcher. The provided directory is used as the base directory and the listing is done recursively. The paths that are returned are relative to the input directory.
Types ¶
type Matcher ¶
func All ¶
All returns a compound Matcher that returns true if all of its provided non-nil Matchers return true. Returns false if no matchers are provided or if all of the provided matchers are nil.
func Any ¶
Any returns a compound Matcher that returns true if any of the provided Matchers return true.
func Hidden ¶
func Hidden() Matcher
Hidden returns a matcher that matches all hidden files or directories (any path that begins with `.`).
func Name ¶
Name returns a Matcher that matches the on the name of all of the components of a path using the provided expressions. Each part of the path (except for ".." components, which are ignored and cannot be matched) is tested against the expressions independently (no path separators). The name must fully match the expression to be considered a match.
func Path ¶
Path returns a Matcher that matches any path that matches or is a subpath of any of the provided paths. For example, a value of "foo" would match the relative directory "foo" and all of its sub-paths ("foo/bar", "foo/bar.txt"), but not every directory named "foo" (would not match "bar/foo"). Matches are done using glob matching (same as filepath.Match). However, unlike filepath.Match, subpath matches will match all of the sub-paths of a given match as well (for example, the pattern "foo/*/bar" matches "foo/*/bar/baz").
func PathLiteral ¶
PathLiteral returns a Matcher that is equivalent to that returned by Paths except that matches are done using string equality rather than using glob matching.
type NamesPathsCfg ¶
type NamesPathsCfg struct { Names []string `yaml:"names,omitempty" json:"names"` Paths []string `yaml:"paths,omitempty" json:"paths"` }
NamesPathsCfg is a configuration object that defines a list of names and paths that should be used to construct a Matcher. The returned Matcher will match any name or path specified in the configuration.
func (*NamesPathsCfg) Add ¶
func (c *NamesPathsCfg) Add(cfg NamesPathsCfg)
Add appends the names and paths specified in the provided NamesPathsCfg to those in the receiver.
func (*NamesPathsCfg) Empty ¶
func (c *NamesPathsCfg) Empty() bool
Empty returns true if the configuration is empty. If this function returns true, it indicates that the semantic meaning of the configuration is the same as it not being provided/specified at all.
func (*NamesPathsCfg) Matcher ¶
func (c *NamesPathsCfg) Matcher() Matcher
Matcher returns a Matcher constructed from the configuration. The Matcher returns true if it matches any of the names or paths in the configuration.
type NamesPathsWithExcludeCfg ¶
type NamesPathsWithExcludeCfg struct { NamesPathsCfg `yaml:",inline,omitempty"` Exclude NamesPathsCfg `yaml:"exclude,omitempty" json:"exclude"` }
NamesPathsWithExcludeCfg is a configuration object that defines a matcher and a set of criteria that should be used to exclude matches. The returned Matcher will match any name or path specified in the configuration provided that the matched path does not match the matcher produced by the "Exclude" configuration.
func (*NamesPathsWithExcludeCfg) Matcher ¶
func (c *NamesPathsWithExcludeCfg) Matcher() Matcher
Matcher returns a Matcher constructed from the configuration. The Matcher returns true if it matches any of the names or paths in the configuration and does not match any of the criteria specified in the "Exclude" configuration.