glob

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STAR     = `([^/]*)`
	GLOBSTER = `((?:[^/]*(?:\/|$))*)`
)

Variables

This section is empty.

Functions

func Glob

func Glob(options ...*Options) ([]string, error)

func Match

func Match(p *ParsedPattern, path string) bool

Types

type Options

type Options struct {
	IgnorePatterns []string
	CWD            string
	Patterns       []string
	AbsolutePaths  bool
}

func CWD

func CWD(cwd string) *Options

func IgnorePattern

func IgnorePattern(pattern string) *Options

func Pattern

func Pattern(pattern string) *Options

type ParsedPattern

type ParsedPattern struct {

	// input is the original glob pattern
	Input      string
	RegExp     *regexp.Regexp
	IsGlobstar bool
	// base is the base folder that can be used for matching a glob.
	// For example if a glob starts with `src/**/*.ts` we don't need to crawl all
	// folders in the current working directory as we see the `src` as base folder
	Base string
	// contains filtered or unexported fields
}

func Parse

func Parse(input string) (*ParsedPattern, error)

func (*ParsedPattern) Compile

func (p *ParsedPattern) Compile() (*ParsedPattern, error)

func (*ParsedPattern) String

func (p *ParsedPattern) String() string

type Patterns

type Patterns = map[string]*ParsedPattern

Jump to

Keyboard shortcuts

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