minimatch

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package minimatch ports minimatch 11.0.3 (the glob matcher Pi's own minimatch() calls use for model scopes and package resource filters) with @isaacs/nonrecursive-glob-match 1.0.3 and brace-expansion 5.0.12: brace expansion, `!` negation, `**`, character classes, extglobs and dot handling. Matching of one path portion is a state-machine simulation, not a regular expression. It does not port the options that no PiG caller sets.

Index

Constants

This section is empty.

Variables

View Source
var ErrPatternTooLong = errors.New("pattern is too long")

ErrPatternTooLong is the TypeError of assertValidPattern.

Functions

func Match

func Match(name, pattern string, options Options) bool

Match reports whether name matches the glob pattern, as minimatch(name, pattern, options). A pattern over MAX_PATTERN_LENGTH, where minimatch throws, matches nothing.

Types

type Minimatch

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

Minimatch is a compiled pattern.

func New

func New(pattern string, options Options) (*Minimatch, error)

New is new Minimatch(pattern, options). It fails where the constructor throws: for a pattern over MAX_PATTERN_LENGTH.

func (*Minimatch) Match

func (m *Minimatch) Match(f string) bool

Match is Minimatch#match(f) without partial matching or matchBase.

type Options

type Options struct {
	// NoCase makes the match case-insensitive.
	NoCase bool
	// Dot lets wildcards match a leading dot.
	Dot bool
	// NoNegate makes a leading `!` literal instead of a negation.
	NoNegate bool
	// Platform is minimatch's platform option: "win32" reads Windows drive letters and UNC roots, anything else, "", means the platform of the running process.
	Platform string
}

Options are the minimatch options that change a match. Every other option has its default.

Jump to

Keyboard shortcuts

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