Skip to content

zealic/xignore

Repository files navigation

Build Status Appveyor Status GoDoc GitHub release

xignore

A golang package for pattern matching of file paths. Like gitignore, dockerignore chefignore.

Requirements

  • Golang ≥ 1.11

Use

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

Reference