File: match.go

package info (click to toggle)
golang-github-monochromegane-go-gitignore 0.0~git20200626.205db1a-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 108 kB
  • sloc: makefile: 2
file content (24 lines) | stat: -rw-r--r-- 374 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package gitignore

import "path/filepath"

type pathMatcher interface {
	match(path string) bool
}

type simpleMatcher struct {
	path string
}

func (m simpleMatcher) match(path string) bool {
	return m.path == path
}

type filepathMatcher struct {
	path string
}

func (m filepathMatcher) match(path string) bool {
	match, _ := filepath.Match(m.path, path)
	return match
}