simplify tags

This commit is contained in:
ston1th 2019-08-25 12:34:10 +02:00
commit 3c5be25cb3
6 changed files with 28 additions and 31 deletions

View file

@ -28,11 +28,24 @@ type Tag struct {
Regex string
}
type Tags []Tag
type RTag struct {
Name string
Regex *regexp.Regexp
}
type RTags []RTag
func (rt RTags) Match(text string) (found []string) {
for _, t := range rt {
if t.Regex.MatchString(text) {
found = append(found, t.Name)
}
}
return
}
type Path struct {
Name string
Abs string