Documentation
¶
Overview ¶
Package changelog keeps track of the current state during the traversal of a changelog document. Things are named according to entries in the grammar.
Index ¶
- type ByName
- type Change
- type ChangeItem
- type ChangeKind
- type ChangeKindDto
- type ChangeKindsDto
- type ChangeMap
- type Changelog
- type Heading
- type HeadingKind
- type HeadingsFactory
- type Introduction
- type Listener
- type Release
- func (h Release) Date() string
- func (h Release) DisplayTitle() string
- func (h Release) HasBeenReleased() bool
- func (h Release) HasBeenYanked() bool
- func (h Release) IsNewerThan(other Release) error
- func (h Release) IsPrerelease() bool
- func (h Release) IsRelease() bool
- func (h Release) Kind() HeadingKind
- func (h Release) Label() string
- func (h Release) NextRelease(semverIdentifier semverConstants.Identifier) semver.Version
- func (h Release) ReleaseIs(otherRelease semver.Version) bool
- func (h Release) String() string
- func (h Release) Title() string
- func (h Release) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByName ¶ added in v1.4.0
type ByName struct{ ChangeKindsDto }
type Change ¶
type Change struct {
// contains filtered or unexported fields
}
Change is a level 3 heaading indicating a change kind
func (Change) DisplayTitle ¶ added in v1.8.0
func (Change) Kind ¶ added in v1.2.0
func (h Change) Kind() HeadingKind
type ChangeItem ¶ added in v1.2.0
type ChangeItem struct {
// contains filtered or unexported fields
}
ChangeItem is a list item, a single change under a Change heading
func (ChangeItem) DisplayTitle ¶ added in v1.8.0
func (h ChangeItem) DisplayTitle() string
func (ChangeItem) Kind ¶ added in v1.2.0
func (h ChangeItem) Kind() HeadingKind
func (ChangeItem) String ¶ added in v1.2.0
func (h ChangeItem) String() string
func (ChangeItem) Title ¶ added in v1.2.0
func (h ChangeItem) Title() string
type ChangeKind ¶ added in v1.4.0
type ChangeKind struct {
// contains filtered or unexported fields
}
ChangeKind collects information about the supported change headers
func NewChangeKind ¶ added in v1.4.0
func NewChangeKind(fileName string) (*ChangeKind, error)
NewChangeKind loads a new ChangeKind from a file
func (*ChangeKind) IncrementFor ¶ added in v1.4.0
func (ck *ChangeKind) IncrementFor(c ChangeMap) (semver.Identifier, string)
IncrementFor returns the increment kind to apply for a set of change kinds and the reason for it.
func (*ChangeKind) MarshalJSON ¶ added in v1.4.0
func (ck *ChangeKind) MarshalJSON() ([]byte, error)
func (*ChangeKind) UnmarshalJSON ¶ added in v1.4.0
func (ck *ChangeKind) UnmarshalJSON(data []byte) error
type ChangeKindDto ¶ added in v1.4.0
type ChangeKindsDto ¶ added in v1.4.0
type ChangeKindsDto []*ChangeKindDto
func (ChangeKindsDto) Len ¶ added in v1.4.0
func (s ChangeKindsDto) Len() int
func (ChangeKindsDto) Swap ¶ added in v1.4.0
func (s ChangeKindsDto) Swap(i, j int)
type Changelog ¶
type Changelog struct {
// contains filtered or unexported fields
}
Changelog is the current state of the changelog during its traversal.
func NewChangelog ¶
func NewChangelog(headingsFactory HeadingsFactory) *Changelog
NewChangelog creates a new empty changelog.
func (*Changelog) Change ¶
Change returns true if we’re currently visiting one of the Change sections.
func (*Changelog) Close ¶ added in v1.2.0
func (c *Changelog) Close()
Close calls the registered Exit listeners for all the un-closed headings.
func (*Changelog) Introduction ¶
Introduction returns true if we’re currently visiting the Introduction section.
func (*Changelog) Listener ¶ added in v1.2.0
Listener registers one or more listeners to this changelog. Listeners are notified as sections are entered and exited.
func (*Changelog) Release ¶
Release returns true if we’re currently visiting one of the Release sections.
func (*Changelog) Section ¶
func (c *Changelog) Section(kind HeadingKind, title string) (Heading, error)
Section sets the state to a new section kind with the given title. Section can go down one-level, for example from Release to Change, or up any number of levels. Section creates and returns the section’s Heading
type Heading ¶
type Heading interface { // The Title of the section Title() string // DisplayTitle is the title to be displayed DisplayTitle() string // Kind is the HeadingKind for the section Kind() HeadingKind String() string }
A Heading is the interface common to every sections.
type HeadingKind ¶
type HeadingKind int
HeadingKind is the type for the multiple sections.
const ( IntroductionHeading HeadingKind = iota ReleaseHeading ChangeHeading ChangeDescription )
type HeadingsFactory ¶ added in v1.8.0
type HeadingsFactory struct {
// contains filtered or unexported fields
}
func NewHeadingFactory ¶ added in v1.8.0
func NewHeadingFactory(changeKind *ChangeKind) HeadingsFactory
func (HeadingsFactory) NewHeading ¶ added in v1.8.0
func (h HeadingsFactory) NewHeading(kind HeadingKind, title string) (Heading, error)
NewHeading is the factory method that, given a kind and a title, returns the appropriate Heading.
type Introduction ¶
type Introduction struct {
// contains filtered or unexported fields
}
Introduction is a level 1 heaading indicating the introduction
func (Introduction) DisplayTitle ¶ added in v1.8.0
func (h Introduction) DisplayTitle() string
func (Introduction) Kind ¶ added in v1.2.0
func (h Introduction) Kind() HeadingKind
func (Introduction) String ¶
func (h Introduction) String() string
func (Introduction) Title ¶
func (h Introduction) Title() string
type Listener ¶ added in v1.2.0
type Listener interface { // Enter is called when a heading is first met. Enter(h Heading) // Exit is called when all of a heading’s children have been visited. Exit(h Heading) }
Listener is notified as a heading is visited
type Release ¶
type Release struct {
// contains filtered or unexported fields
}
func (Release) Date ¶
Date returns the release date if this has been released, an empty string otherwise.
func (Release) DisplayTitle ¶ added in v1.8.0
func (Release) HasBeenReleased ¶
HasBeenReleased returns true if this has ever been released
func (Release) HasBeenYanked ¶
HasBeenYanked returns true if this release has been yanked.
func (Release) IsNewerThan ¶
IsNewerThan returns an error if this release if not newer than another release. A release is newer if it has the same or a more recent date and one its version has been incremented.
func (Release) IsPrerelease ¶ added in v1.1.0
IsPrerelease returns true if this release is a pre-release without build number component.
func (Release) IsRelease ¶
IsRelease returns true if this release is a release without pre-release or build number component.
func (Release) Kind ¶ added in v1.2.0
func (h Release) Kind() HeadingKind
func (Release) NextRelease ¶
func (h Release) NextRelease(semverIdentifier semverConstants.Identifier) semver.Version
NextRelease computes what the next version number should be given a set of changes.