https://github.com/zealic/xignore
A golang package for pattern matching of file paths. Like gitignore, dockerignore chefignore.
https://github.com/zealic/xignore
file-matching gitignore golang ignore ignorefile
Last synced: about 1 year ago
JSON representation
A golang package for pattern matching of file paths. Like gitignore, dockerignore chefignore.
- Host: GitHub
- URL: https://github.com/zealic/xignore
- Owner: zealic
- License: mit
- Created: 2017-11-01T19:31:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-10-08T07:08:07.000Z (over 4 years ago)
- Last Synced: 2025-03-29T23:41:10.456Z (about 1 year ago)
- Topics: file-matching, gitignore, golang, ignore, ignorefile
- Language: Go
- Homepage: https://www.zealic.com/projects/xignore
- Size: 35.2 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status][travis-image]][travis-url]
[![Appveyor Status][appveyor-image]][appveyor-url]
[![GoDoc][godoc-image]][godoc-url]
[![GitHub release][release-image]][release-url]
# xignore
A golang package for pattern matching of file paths. Like gitignore, dockerignore chefignore.
## Requirements
* Golang ≥ 1.11
## Use
```golang
result, _ := xignore.DirMatches("/workspace/my_project", &xignore.MatchesOptions{
Ignorefile: ".gitignore",
Nested: true, // Handle nested ignorefile
})
// ignorefile rules matched files
fmt.Printf("%#v\n", result.MatchedFiles)
// ignorefile rules unmatched files
fmt.Printf("%#v\n", result.UnmatchedFiles)
// ignorefile rules matched dirs
fmt.Printf("%#v\n", result.MatchedDirs)
// ignorefile rules unmatched dirs
fmt.Printf("%#v\n", result.UnmatchedDirs)
```
## LICENSE
[MIT](https://github.com/zealic/xignore/blob/master/LICENSE.txt)
## Reference
* https://git-scm.com/docs/gitignore
* https://github.com/moby/moby/blob/master/pkg/fileutils/fileutils.go
[travis-image]: https://travis-ci.org/zealic/xignore.svg
[travis-url]: https://travis-ci.org/zealic/xignore
[appveyor-image]: https://ci.appveyor.com/api/projects/status/avl6x1qease9bjic?svg=true
[appveyor-url]: https://ci.appveyor.com/project/zealic/xignore
[godoc-image]: https://godoc.org/github.com/zealic/xignore?status.svg
[godoc-url]: https://godoc.org/github.com/zealic/xignore
[release-image]: https://img.shields.io/github/release/zealic/xignore.svg
[release-url]: https://github.com/zealic/xignore/releases