glob

package
v0.112.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterGlobParts

func FilterGlobParts(a []string) []string

FilterGlobParts removes any string with glob wildcard.

func GetGlob

func GetGlob(pattern string) (glob.Glob, error)

func HasGlobChar

func HasGlobChar(s string) bool

HasGlobChar returns whether s contains any glob wildcards.

func NormalizePath

func NormalizePath(p string) string

func NormalizePathNoLower added in v0.104.0

func NormalizePathNoLower(p string) string

func Or added in v0.112.0

func Or(globs ...glob.Glob) glob.Glob

Or creates a new Glob from the given globs.

func ResolveRootDir

func ResolveRootDir(p string) string

ResolveRootDir takes a normalized path on the form "assets/**.json" and determines any root dir, i.e. any start path without any wildcards.

Types

type FilenameFilter added in v0.89.0

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

func MustNewFilenameFilter added in v0.89.0

func MustNewFilenameFilter(inclusions, exclusions []string) *FilenameFilter

MustNewFilenameFilter invokes NewFilenameFilter and panics on error.

func NewFilenameFilter added in v0.89.0

func NewFilenameFilter(inclusions, exclusions []string) (*FilenameFilter, error)

NewFilenameFilter creates a new Glob where the Match method will return true if the file should be included. Note that the inclusions will be checked first.

func NewFilenameFilterForInclusionFunc added in v0.89.0

func NewFilenameFilterForInclusionFunc(shouldInclude func(filename string) bool) *FilenameFilter

NewFilenameFilterForInclusionFunc create a new filter using the provided inclusion func.

func (*FilenameFilter) Match added in v0.89.0

func (f *FilenameFilter) Match(filename string, isDir bool) bool

Match returns whether filename should be included.

type MatchesFunc added in v0.112.0

type MatchesFunc func(s string) bool

MatchesFunc is a convenience type to create a glob.Glob from a function.

func (MatchesFunc) Match added in v0.112.0

func (m MatchesFunc) Match(s string) bool

Jump to

Keyboard shortcuts

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