pattern

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pattern defines the structure for a gitignore pattern.

Index

Constants

View Source
const (
	// ErrInvalidRegex is returned when a regular expression fails to compile.
	ErrInvalidRegex xerrors.Error = "invalid regex"

	// ErrScanningFile is returned when scanning a file fails for any reason.
	ErrScanningFile xerrors.Error = "failed to scan file"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Pattern

type Pattern struct {
	// Regex is the compiled regular expression for this pattern.
	Regex *regexp.Regexp

	// Negate indicates whether the pattern should be negated.
	Negate bool
}

Pattern represents a parsed gitignore pattern.

func Parse

func Parse(r io.Reader) ([]*Pattern, error)

Parse parses a .gitignore file into a list of patterns.

Jump to

Keyboard shortcuts

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