changelog

package
v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

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

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 }

func (ByName) Less added in v1.4.0

func (s ByName) Less(i, j int) bool

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 (h Change) DisplayTitle() string

func (Change) Kind added in v1.2.0

func (h Change) Kind() HeadingKind

func (Change) String

func (h Change) String() string

func (Change) Title

func (h Change) Title() string

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 ChangeKindDto struct {
	Name      string `json:"name"`
	Increment string `json:"increment"`
	Emoji     string `json:"emoji,omitempty"`
}

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 ChangeMap

type ChangeMap map[string]bool

ChangeMap tracks the Changes that have been defined in a release

func (ChangeMap) String added in v1.4.0

func (c ChangeMap) String() string

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

func (c *Changelog) Change() bool

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

func (c *Changelog) Introduction() bool

Introduction returns true if we’re currently visiting the Introduction section.

func (*Changelog) Listener added in v1.2.0

func (c *Changelog) Listener(l ...Listener)

Listener registers one or more listeners to this changelog. Listeners are notified as sections are entered and exited.

func (*Changelog) Release

func (c *Changelog) Release() bool

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

func (*Changelog) String

func (c *Changelog) String() string

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

func (h Release) Date() string

Date returns the release date if this has been released, an empty string otherwise.

func (Release) DisplayTitle added in v1.8.0

func (h Release) DisplayTitle() string

func (Release) HasBeenReleased

func (h Release) HasBeenReleased() bool

HasBeenReleased returns true if this has ever been released

func (Release) HasBeenYanked

func (h Release) HasBeenYanked() bool

HasBeenYanked returns true if this release has been yanked.

func (Release) IsNewerThan

func (h Release) IsNewerThan(other Release) error

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

func (h Release) IsPrerelease() bool

IsPrerelease returns true if this release is a pre-release without build number component.

func (Release) IsRelease

func (h Release) IsRelease() bool

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) Label

func (h Release) Label() string

Label returns the optional label of this release.

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.

func (Release) ReleaseIs

func (h Release) ReleaseIs(otherRelease semver.Version) bool

ReleaseIs returns true this release is equal to the otherRelease

func (Release) String

func (h Release) String() string

func (Release) Title

func (h Release) Title() string

func (Release) Version

func (h Release) Version() string

Version returns the release version if this has been released, an empty string otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL