Documentation ¶
Overview ¶
Package changelog has been designed to parse CHANGELOG.md and give access to the information about existing releases. However, in the future, it may support manipulating and generating changelogs as well if that kind of behaviour will be needed in our CLI tools.
It's based on the "Keep a Changelog" v1.0.0 specification: https://keepachangelog.com/en/1.0.0/
Index ¶
- type Changelog
- type Controller
- type Release
- func (r *Release) AddAdded(desc string)
- func (r *Release) AddChanged(desc string)
- func (r *Release) AddDeprecated(desc string)
- func (r *Release) AddFixed(desc string)
- func (r *Release) AddRemoved(desc string)
- func (r *Release) AddSecurity(desc string)
- func (r *Release) CountChanges() int
- func (r *Release) DateString() string
- func (r *Release) HasChanges() bool
- func (r *Release) HasText() bool
- type ReleaseChange
- type ReleaseController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Changelog ¶
type Changelog struct { // Releases holds a list of all releases. Releases []Release // contains filtered or unexported fields }
Changelog represents the changelog itself.
func (*Changelog) AddRelease ¶
AddRelease adds a new release.
func (*Changelog) FirstRelease ¶
FirstRelease returns the first Release which usually points to the "Initial release".
func (*Changelog) HasReleases ¶
HasReleases checks if there are any releases.
func (*Changelog) LatestRelease ¶
LatestRelease returns the latest Release which usually points to the "Unreleased" one.
type Controller ¶
type Controller interface { Load(string) error AddRelease(Release) HasReleases() bool FirstRelease() *Release LatestRelease() *Release }
Controller is the interface that wraps the Changelog methods.
type Release ¶
type Release struct { // Title is an original release title. Usually, it's either "Unreleased" or, // as an example, "[1.0.0] - 2017-06-20". Title string // Date is a release date that is parsed from Title. For example, // "2017-06-20". Date *time.Time // Link is a release link which usually can be found in the footnotes. Link string // Version is a release version itself in a semantic versioning format: // https://semver.org/ Version *semver.Version // Text is a release text that doesn't fit into changes. For example, the text // like "Initial release" in the first release. Text string // Added holds a list of all "Added" changes. Added []ReleaseChange // Changed holds a list of all "Changed" changes. Changed []ReleaseChange // Deprecated holds a list of all "Deprecated" changes. Deprecated []ReleaseChange // Removed holds a list of all "Removed" changes. Removed []ReleaseChange // Fixed holds a list of all "Fixed" changes. Fixed []ReleaseChange // Security holds a list of all "Security" changes. Security []ReleaseChange }
Release represents a single CHANGELOG.md release.
func (*Release) AddChanged ¶
AddChanged adds a new "Changed" change.
func (*Release) AddDeprecated ¶
AddDeprecated adds a new "Deprecated" change.
func (*Release) AddRemoved ¶
AddRemoved adds a new "Removed" change.
func (*Release) AddSecurity ¶
AddSecurity adds a new "Fixed" change.
func (*Release) CountChanges ¶
CountChanges counts the total number of changes.
func (*Release) DateString ¶
DateString returns a string representation of a Date.
func (*Release) HasChanges ¶
HasChanges checks if a release has any changes.
type ReleaseChange ¶
type ReleaseChange struct {
Value string
}
ReleaseChange represents a single release change. Created to be extended in the future to hold values in different formats like Plain Text, Markdown and Steam Workshop.
func NewReleaseChange ¶
func NewReleaseChange(value string) *ReleaseChange
NewReleaseChange creates a new ReleaseChange instance with the provided value.
type ReleaseController ¶
type ReleaseController interface { AddAdded(string) AddChanged(string) AddDeprecated(string) AddRemoved(string) AddFixed(string) AddSecurity(string) CountChanges() int HasChanges() bool HasText() bool DateString() string }
ReleaseController is the interface that wraps the Release methods.