Add simple "HasTag" function for a Manifest2822Entry

This commit is contained in:
Tianon Gravi 2016-05-27 13:19:04 -07:00
parent 8a9af33071
commit 04af83c7d7
1 changed files with 11 additions and 4 deletions

View File

@ -128,12 +128,19 @@ func (manifest Manifest2822) String() string {
return strings.Join(ret, "\n\n")
}
func (entry Manifest2822Entry) HasTag(tag string) bool {
for _, existingTag := range entry.Tags {
if tag == existingTag {
return true
}
}
return false
}
func (manifest Manifest2822) GetTag(tag string) *Manifest2822Entry {
for _, entry := range manifest.Entries {
for _, existingTag := range entry.Tags {
if tag == existingTag {
return &entry
}
if entry.HasTag(tag) {
return &entry
}
}
return nil