releaser-pleaser/internal/updater/updater.go

24 lines
506 B
Go
Raw Permalink Normal View History

package updater
type ReleaseInfo struct {
Version string
ChangelogEntry string
}
type Updater interface {
Files() []string
CreateNewFiles() bool
Update(info ReleaseInfo) func(content string) (string, error)
}
type NewUpdater func(ReleaseInfo) Updater
func WithInfo(info ReleaseInfo, constructors ...NewUpdater) []Updater {
updaters := make([]Updater, 0, len(constructors))
for _, constructor := range constructors {
updaters = append(updaters, constructor(info))
}
return updaters
}