changelog

package
v0.0.0-...-a5ab9a2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeTypeLabel

func ChangeTypeLabel(changeType ChangeType) string

func CompleteReleasesAsFirstArgument

func CompleteReleasesAsFirstArgument(
	cmd *cobra.Command,
	args []string,
	toComplete string,
) ([]string, cobra.ShellCompDirective)

Can be passed as ValidArgsFunction to support custom completions if the first argument is a released version.

func FindChangelogIn

func FindChangelogIn(directory string) (string, bool)

func HasChanges

func HasChanges(sections *([]Section)) bool

func ResolvePathToChangelog

func ResolvePathToChangelog() (string, error)
func Search(changelog *Changelog, query string) string

func Show

func Show(contents string) error

Types

type Bounds

type Bounds struct {
	Start int
	Stop  int
}

func EmptyBounds

func EmptyBounds() Bounds

type ChangeType

type ChangeType int64
const (
	Added ChangeType = iota
	Changed
	Deprecated
	Fixed
	Removed
	Security
	Unknown
)

func KnownChangeTypes

func KnownChangeTypes() []ChangeType

func LastChangeType

func LastChangeType() ChangeType

func ParseChangeType

func ParseChangeType(name string) ChangeType

type Changelog

type Changelog struct {
	Title    string
	Releases Releases
	// contains filtered or unexported fields
}

func Parse

func Parse(source []byte) Changelog

func ResolveChangelog

func ResolveChangelog() (*Changelog, string, error)

func (*Changelog) AddItem

func (changelog *Changelog) AddItem(changeType ChangeType, contents string) string

func (*Changelog) ContentWithin

func (changelog *Changelog) ContentWithin(bounds *Bounds) string

func (*Changelog) Diff

func (changelog *Changelog) Diff(from string, to string) (string, error)

Shows everything between the two given versions.

func (*Changelog) DiffLen

func (changelog *Changelog) DiffLen(other string) int

func (*Changelog) FindRelease

func (changelog *Changelog) FindRelease(version string) *Release

func (*Changelog) Merge

func (changelog *Changelog) Merge(from string, to string, prefixItemsWithVersion bool) (string, error)

Merges

func (*Changelog) ReplacedWithinBounds

func (changelog *Changelog) ReplacedWithinBounds(bounds Bounds, replacement string) string

func (*Changelog) Stop

func (changelog *Changelog) Stop() int

Returns the end index of the changelog

func (*Changelog) WithAddition

func (changelog *Changelog) WithAddition(insertionPoint int, addition string) string

func (*Changelog) Yank

func (changelog *Changelog) Yank(version string) (string, error)

type Item

type Item struct {
	Bounds Bounds
}

type NewLines

type NewLines struct {
	Before int
	After  int
}

func (*NewLines) Join

func (p *NewLines) Join(before string, subject string, after string) string

type NextRelease

type NextRelease struct {
	HeadlineBounds Bounds
	Bounds         Bounds
	Sections       []Section
}

func (*NextRelease) FindSection

func (next *NextRelease) FindSection(changeType ChangeType) *Section

type Release

type Release struct {
	Sections []Section
	Date     string
	Yanked   bool
	Version  string

	HeadlineBounds Bounds
	Bounds         Bounds
}

func NewRelease

func NewRelease(version string, date string) Release

type Releases

type Releases struct {
	Next *NextRelease
	Past []Release
}

type Section

type Section struct {
	Type   ChangeType
	Items  []Item
	Bounds Bounds
}

Jump to

Keyboard shortcuts

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