changelog

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

README

gokeepachangelog

Enabling you to do fun things with a changelog.

Build Status codecov.io Go Report Card Apache V2 License Quality Gate Status GitHub release PkgGoDev

Summary

Keeping a changelog as https://keepachangelog.com suggests is a great way to help communicate releases of software. This library processes that file into a useful go structure that can be examined, updated and output.

Table of Contents

Code of Conduct

This project and everyone participating in it are governed by the XMiDT Code Of Conduct. By participating, you agree to this Code.

Details

Add details here.

Install

Add details here.

Contributing

Refer to CONTRIBUTING.md.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParsing = errors.New("there was an error parsing")
)

Functions

This section is empty.

Types

type Changelog

type Changelog struct {
	// The https://keepachangelog.com version of this file.
	KeepAChangelogVersion string

	// The semantic version policy this file conforms.
	SemVerVersion string

	// Any header comments that might exist before the main body of contents.
	CommentHeader []string

	// The title of the changelog.  Generally will be "Changelog".
	Title string

	// The description body about the change log and what it conforms to.
	Description []string

	// The collection of releases provided by this changelog file.
	Releases []Release

	// The collection of links showing the differences between release versions.
	Links []Link
}

The Changelog structure contains the entire changelog. It may be populated from a file or programatically.

func Parse

func Parse(r io.Reader) (*Changelog, error)

Parse takes a bufio.Scanner and processes the file into

func (*Changelog) ToMarkdown

func (cl *Changelog) ToMarkdown() string

ToMarkdown converts the Changelog structure into a markdown formatted stream of characters and returns the string.

type Link struct {
	// The version of the release.  It could be v1.0.2, 1.0.3-pre1 or Unreleased
	// as examples.
	Version string

	// The following URL that describes the difference between this release and
	// the previous release
	Url string
}

The Link structure containing the release version and the representing URL.

func (*Link) ToMarkdown

func (l *Link) ToMarkdown() string

ToMarkdown converts the Link structure into a markdown formatted stream of characters and returns the string.

type Release

type Release struct {
	// The entire text following the ## prefix.
	Title string

	// The version of the release.  It could be v1.0.2, 1.0.3-pre1 or Unreleased
	// as examples.
	Version string

	// The date of the release if present.
	Date *time.Time

	// If a release has been yanked.
	Yanked bool

	// The lines under the '### Added` header.
	Added []string

	// The lines under the '### Changed' header.
	Changed []string

	// The lines under the '### Depreceted' header.
	Deprecated []string

	// The lines under the '### Removed' header.
	Removed []string

	// The lines under the '### Fixed' header.
	Fixed []string

	// The lines under the '### Security' header.
	Security []string

	// The lines the might immediately follow the release line but not be
	// associated with any specific header.
	Other []string

	// The entire body of the release in case that is useful.
	Body []string
}

Release represents a documented release.

func (*Release) ToMarkdown

func (r *Release) ToMarkdown() string

ToMarkdown converts the Release structure into a markdown formatted stream of characters and returns the string.

Jump to

Keyboard shortcuts

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