Documentation ¶
Overview ¶
Package parseignore implements a subset of the gitignore specification.
This implementation does not support the ** special syntax.
More details for gitignore are available at: http://git-scm.com/docs/gitignore
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision int
Decision is used in tri-state logic Look at the constants defined below for more information
const ( // Pass indicates the Matcher does not have any specific decision about // the given path. Pass Decision = iota // Include indicates the Matcher decided to explicitly include the path. // This is used for negation, or patterns that explicitly want to include // files when they were otherwise excluded by an earlier rule. Include // Exclude indicates a pattern matches file path and wants to explicitly // exclude it Exclude )
type Matcher ¶
Matcher matches paths and returns a bool indicating if the path should be ignored or not.
func CompilePatterns ¶
CompilePatterns compiles the patterns contained in the provided contents (separated by newlines). It follows a subset of the gitignore specification, including rules such as ignoring blank or whitespace only lines. It also ignores line that begin with a `#`. Additionally even when we encounter errors in compiling patterns we return a Matcher that respects the patterns that were successfully compiled.
func ComponentNameMatcher ¶
ComponentNameMatcher returns a Matcher that checks if any of the path components match the given name.
func GlobMatcher ¶
GlobMatcher returns a Matcher that checks the path against the provided glob.
func InverseMatcher ¶
InverseMatcher returns a Matcher that inverts the decision of the given matcher.
func MultiMatcher ¶
MultiMatcher returns a single Matcher that runs thru the ordered list of Matchers, where the last decision wins.