Matcher
Matcher is a fast path matcher/globber supporting globstar/doublestar
Install / Use
/learn @saracen/MatcherREADME
matcher
matcher is similar to path.Match, but:
- Supports globstar/doublestar (
**). - Provides a fast
Globfunction. - Supports combining matchers.
Examples
Match
package main
import "github.com/saracen/matcher"
func main() {
matched, err := matcher.Match("hello/**/world", "hello/foo/bar/world")
if err != nil {
panic(err)
}
if matched {
// do something
}
}
Glob
package main
import "github.com/saracen/matcher"
func main() {
matches, err := matcher.Glob(context.Background(), ".", matcher.New("**/*.go"))
if err != nil {
panic(err)
}
// do something with the matches
_ = matches
}
Glob with multiple patterns
package main
import "github.com/saracen/matcher"
func main() {
matcher := matcher.Multi(
matcher.New("**/*.go"),
matcher.New("**/*.txt"))
matches, err := matcher.Glob(context.Background(), ".", matcher)
if err != nil {
panic(err)
}
// do something with the matches
_ = matches
}
Related Skills
xurl
345.9kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
openhue
345.9kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
345.9kElevenLabs text-to-speech with mac-style say UX.
weather
345.9kGet current weather and forecasts via wttr.in or Open-Meteo
