Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukasholzer/go-glob
Glob matching library for golang supporting globstar and ignore files according to .gitignore spec
https://github.com/lukasholzer/go-glob
glob globbing globstar go golang match pattern
Last synced: about 1 month ago
JSON representation
Glob matching library for golang supporting globstar and ignore files according to .gitignore spec
- Host: GitHub
- URL: https://github.com/lukasholzer/go-glob
- Owner: lukasholzer
- License: gpl-3.0
- Created: 2022-03-04T17:53:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-07T16:07:53.000Z (almost 3 years ago)
- Last Synced: 2024-10-16T07:09:29.306Z (3 months ago)
- Topics: glob, globbing, globstar, go, golang, match, pattern
- Language: Go
- Homepage:
- Size: 44.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glob
[![Main](https://github.com/lukasholzer/go-glob/actions/workflows/main.yml/badge.svg)](https://github.com/lukasholzer/go-glob/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/lukasholzer/go-glob/branch/main/graph/badge.svg?token=1RS0He2qXE)](https://codecov.io/gh/lukasholzer/go-glob)## Usage
The most simple form would be by just providing a glob pattern
```golang
files, err := glob.Glob(glob.Pattern("**/*.txt"))
```You can pass additionally to a pattern multiple options like `IgnoreFiles`. The Ignore files will parse the provided files according to the [Git Ignore Spec](http://git-scm.com/docs/gitignore) and will ignore the directories or files.
```golang
files, err := glob.Glob(glob.Pattern("**/*"), glob.IgnoreFile(".gitignore"))
```The Ign
Advanced configuration use case:
```golang
files, err := glob.Glob(&glob.Options{
Patterns: []string{"**/*.txt"},
CWD: "/some/abs/path",
IgnorePatterns: []string{"node_modules", "other/*.file"},
})
```## Installation
```bash
go get -u github.com/lukasholzer/go-glob
```