Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goreleaser/fileglob
A file globbing library.
https://github.com/goreleaser/fileglob
Last synced: about 1 month ago
JSON representation
A file globbing library.
- Host: GitHub
- URL: https://github.com/goreleaser/fileglob
- Owner: goreleaser
- License: mit
- Created: 2020-11-06T21:37:40.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T11:57:20.000Z (7 months ago)
- Last Synced: 2024-03-23T07:05:11.814Z (6 months ago)
- Language: Go
- Homepage:
- Size: 81.1 KB
- Stars: 62
- Watchers: 8
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
fileglob
A file globbing library.
## What
`fileglob` is a glob library that uses [gobwas/glob](https://github.com/gobwas/glob) underneath
and returns only matching files or direcories, depending on the configuration. Due to this great foundation, `fileglob` supports:* Asterisk wildcards (`*`)
* Super-asterisk wildcards (`**`)
* Single symbol wildcards (`?`)
* Character list matchers with negation and ranges (`[abc]`, `[!abc]`, `[a-c]`)
* Alternative matchers (`{a,b}`)
* Nested globbing (`{a,[bc]}`)
* Escapable wildcards (`\{a\}/\*` and `fileglob.QuoteMeta(pattern)`)By also building on top of `fs.FS`, a range of alternative filesystems as well as custom filesystems are supported.
## Why
[gobwas/glob](https://github.com/gobwas/glob) is very well implemented: it has
a lexer, compiler, and all that, which seems like a better approach than most
libraries do: regex.It doesn't have a `Walk` method though, and we needed it
[in a couple of places](https://github.com/goreleaser/fileglob/issues/232).
So we decided to implement it ourselves, a little bit based on how
[mattn/go-zglob](http://github.com/mattn/go-zglob) works.