Documentation
¶
Overview ¶
Package fileglob provides a filesystem glob API.
Index ¶
- func ContainsMatchers(pattern string) bool
- func Glob(pattern string, opts ...OptFunc) ([]string, error)
- func MatchDirectoryAsFile(opts *globOptions)
- func MatchDirectoryIncludesContents(opts *globOptions)
- func MaybeRootFS(opts *globOptions)
- func QuoteMeta(opts *globOptions)
- func ValidPattern(pattern string) error
- type OptFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsMatchers ¶ added in v0.3.0
ContainsMatchers determines whether the pattern contains any type of glob matcher. It will also return false if the pattern is an invalid expression.
func Glob ¶
Glob returns all files that match the given pattern in the current directory. If the given pattern indicates an absolute path, it will glob from `/`. If the given pattern starts with `../`, it will resolve to its absolute path and glob from `/`.
func MatchDirectoryAsFile ¶ added in v0.4.0
func MatchDirectoryAsFile(opts *globOptions)
MatchDirectoryAsFile makes a match on a directory match its name only.
Also check MatchDirectoryIncludesContents.
func MatchDirectoryIncludesContents ¶ added in v0.4.0
func MatchDirectoryIncludesContents(opts *globOptions)
MatchDirectoryIncludesContents makes a match on a directory match all files inside it as well.
This is the default behavior.
Also check MatchDirectoryAsFile.
func MaybeRootFS ¶ added in v1.0.1
func MaybeRootFS(opts *globOptions)
MaybeRootFS setups fileglob to walk from the root directory (/) or volume (on windows) if the given pattern is an absolute path.
Result will also be prepended with the root path or volume.
func QuoteMeta ¶
func QuoteMeta(opts *globOptions)
QuoteMeta quotes all glob pattern meta characters inside the argument text. For example, QuoteMeta for a pattern `{foo*}` sets the pattern to `\{foo\*\}`.
func ValidPattern ¶ added in v0.3.0
ValidPattern determines whether a pattern is valid. It returns the parser error if the pattern is invalid and nil otherwise.