-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxignore.go
31 lines (28 loc) · 848 Bytes
/
xignore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package xignore
// MatchesOptions matches options
type MatchesOptions struct {
// Ignorefile name, similar '.gitignore', '.dockerignore', 'chefignore'
Ignorefile string
// Allow nested ignorefile
Nested bool
// apply patterns before all ignorefile
BeforePatterns []string
// apply patterns after all ignorefile
AfterPatterns []string
}
// MatchesResult matches result
type MatchesResult struct {
BaseDir string
// ignorefile rules matched files
MatchedFiles []string
// ignorefile rules unmatched files
UnmatchedFiles []string
// ignorefile rules matched dirs
MatchedDirs []string
// ignorefile rules unmatched dirs
UnmatchedDirs []string
}
// DirMatches returns match result from basedir.
func DirMatches(basedir string, options *MatchesOptions) (*MatchesResult, error) {
return NewSystemMatcher().Matches(basedir, options)
}