changelog

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeLine

type ChangeLine struct {
	// What the change entails.
	Summary string
	// Reference can be either a username (e.g. @parkr) or a PR number
	// (e.g. #1234).
	Reference string
}

ChangeLine contains the data for a single change. Acceptable formats:

  • This is a change (#1234)
  • This is another change. (@parkr)
  • This is a change w/o a reference.

The references must be encased in parentheses, and only one reference is currently supported.

func (*ChangeLine) String

func (l *ChangeLine) String() string

String returns the markdown representation of the ChangeLine. E.g. " * Added documentation. (#123)"

type Changelog

type Changelog struct {
	Versions []*Version
}

Changelog represents a changelog in its entirety, containing all the versions that are tracked in the changelog. For supported formats, see the documentation for Version.

func NewChangelog

func NewChangelog() *Changelog

NewChangelog creates a pristine Changelog.

func NewChangelogFromFile

func NewChangelogFromFile(filename string) (*Changelog, error)

NewChangelog builds a changelog from the file at the provided filename.

func NewChangelogFromReader

func NewChangelogFromReader(reader io.Reader) (*Changelog, error)

NewChangelogFromReader builds a changelog from the contents read in through the reader it's passed.

func (*Changelog) AddLineToSubsection

func (c *Changelog) AddLineToSubsection(versionNum, subsectionName string, line *ChangeLine)

AddLineToSubsection adds a ChangeLine to the given version's subsection's history.

For example, this could be used to add a change to v1.4.2's "Major Enhancements" subsection.

func (*Changelog) AddLineToVersion

func (c *Changelog) AddLineToVersion(versionNum string, line *ChangeLine)

AddLineToVersion adds a ChangeLine to the given version's direct history. This is only to be used when it is inappropriate to add it to a subsection, or the version's changes don't warrant subsections.

func (*Changelog) GetSubsection

func (c *Changelog) GetSubsection(versionNum, subsectionName string) *Subsection

GetSubsection fetches the Subsection struct which matches the versionNum & subsectionName. Returns nil if no version was found matching the given versionNum & subsectionName.

func (*Changelog) GetSubsectionOrCreate

func (c *Changelog) GetSubsectionOrCreate(versionNum, subsectionName string) *Subsection

GetSubsection fetches the Subsection struct which matches the versionNum & subsectionName. If no subsection was found matching the given versionNum & subsectionName, it creates it and saves it to the Changelog.

func (*Changelog) GetVersion

func (c *Changelog) GetVersion(versionNum string) *Version

GetVersion fetches the Version struct which matches the versionNum. Returns nil if no version was found matching the given versionNum.

func (*Changelog) GetVersionOrCreate

func (c *Changelog) GetVersionOrCreate(versionNum string) *Version

GetVersion fetches the Version struct which matches the versionNum. If no version was found matching the given versionNum, it creates and saves it to the Changelog.

type Subsection

type Subsection struct {
	Name    string
	History []*ChangeLine
}

Subsection contains the data for a given subsection. Acceptable format:

### Subsection Name Here

Common subsections are "Major Enhancements," and "Bug Fixes."

func NewSubsection

func NewSubsection(subsectionName string) *Subsection

NewSubsection creates a subsection for the given name and initializes its history.

type Version

type Version struct {
	Version     string
	Date        string
	History     []*ChangeLine
	Subsections []*Subsection
	// contains filtered or unexported fields
}

Version contains the data for the changes for a given version. It can have both direct history and subsections. Acceptable formats:

## 2.4.1
## 2.4.1 / 2015-04-23

func NewVersion

func NewVersion(versionNum string) *Version

NewVersion allocates a new Version struct with all the fields initialized except {{.Date}}.

Jump to

Keyboard shortcuts

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