mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-21 12:00:40 +00:00
parent
19bf65fbb3
commit
79df6b030f
@ -34,6 +34,7 @@ type OutputFormatterImpl struct {
|
||||
func NewOutputFormatter(templatesFS fs.FS) *OutputFormatterImpl {
|
||||
templateFNs := map[string]interface{}{
|
||||
"timefmt": timeFormat,
|
||||
"getSection": getSection,
|
||||
}
|
||||
tpls := template.Must(template.New("templates").Funcs(templateFNs).ParseFS(templatesFS, "*"))
|
||||
return &OutputFormatterImpl{templates: tpls}
|
||||
@ -94,3 +95,12 @@ func timeFormat(t time.Time, format string) string {
|
||||
}
|
||||
return t.Format(format)
|
||||
}
|
||||
|
||||
func getSection(sections []ReleaseNoteSection, name string) ReleaseNoteSection {
|
||||
for _, section := range sections {
|
||||
if section.SectionName() == name {
|
||||
return section
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user