Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CommitRegex is used to parse the first line of commits CommitRegex = regexp.MustCompile(`^([^:\(]+?)(?:\(([^\)]*?)?\))?:(.*)`) // ClosesRegex is used to find any closes links ClosesRegex = regexp.MustCompile(`(?:Closes|Fixes|Resolves)\s((?:#(\d+)(?:,\s)?)+)`) // BreaksRegex is used to find any breaks links BreaksRegex = regexp.MustCompile(`(?:Breaks|Broke)\s((?:#(\d+)(?:,\s)?)+)`) // BreakingRegex is used to find anything that is a breaking change BreakingRegex = regexp.MustCompile(`(?i:breaking)`) )
var DefaultOrder = []string{
"Features",
"Bug Fixes",
"Performance",
"Breaking Changes",
"Unknown",
}
DefaultOrder defines the default order of sections in the change log
Functions ¶
This section is empty.
Types ¶
type ChangeLog ¶
type ChangeLog struct { Repo string `toml:"repo"` Version string `toml:"version"` PatchVersion bool `toml:"patch_ver"` Subtitle string `toml:"subtitle"` }
ChangeLog is a type for general configuration for producing a changelog
type Commit ¶
type Commit struct { Hash string Subject string Component string Closes []string Breaks []string CommitType string // contains filtered or unexported fields }
Commit is a struct for representing a git commit
type Commits ¶
type Commits []Commit
Commits is a slice of Commit
func FilterCommits ¶
FilterCommits only keeps commits that are to be included in the changelog
func FormatCommits ¶
func FormatCommits(commits Commits, sectionAliasMap SectionAliasMap) Commits
FormatCommits sets the CommitType on each commit from the given SectionAliasMap
func TitleCommitType ¶
func TitleCommitType(commits Commits, sectionAliasMap SectionAliasMap) Commits
TitleCommitType sets the CommitType on each commit to the title case of itself.
This is used if you wanted change log sections that are not defined in a `.clog.toml`
type ComponentMap ¶
ComponentMap is a map whose keys are the components changed, and values are any associated commits
type Querier ¶
type Querier interface { GetCommits(from, to string) (Commits, error) GetCommitRange(from, to time.Time) (Commits, error) GetOrigin() (string, error) GetLatestCommit() (string, error) GetLatestTag() (string, error) GetLatestTagVersion() (string, error) GetConfig() (io.Reader, error) }
Querier is an interface for the functions needed to generate a changelog from a git repository
func NewGithubQuerier ¶
NewGithubQuerier queries Github for commits
func NewLocalQuerier ¶
NewLocalQuerier returns a querier that queries off of a local git repostiroy
type SectionAliasMap ¶
SectionAliasMap is for associating commit prefixes to a section of the changelog
func MergeSectionAliasMaps ¶
func MergeSectionAliasMaps(first SectionAliasMap, additional ...SectionAliasMap) SectionAliasMap
MergeSectionAliasMaps merges multiple maps into the first and returns the first
func NewSectionAliasMap ¶
func NewSectionAliasMap() SectionAliasMap
NewSectionAliasMap returns the default map
func (SectionAliasMap) Grep ¶
func (s SectionAliasMap) Grep() string
Grep produces a regex to search for lines starting with each section key
func (SectionAliasMap) SectionFor ¶
func (s SectionAliasMap) SectionFor(alias string) string
SectionFor returns the section title for a given alias
type SectionMap ¶
type SectionMap struct { Sections map[string]ComponentMap // contains filtered or unexported fields }
SectionMap is a map whose keys are the commit type, and values are a ComponentMap
func NewSectionMap ¶
func NewSectionMap(commits Commits) SectionMap
NewSectionMap returns a new SectionMap for the given commits
func (SectionMap) Order ¶
func (s SectionMap) Order() []string
Order returns the order the sections will appear in the change log
func (*SectionMap) SetOrder ¶
func (s *SectionMap) SetOrder(order []string)
SetOrder sets the order of the sections in the changelog. Any non-specified sections will be appended to the end alphabetically. Any sections that don't exist will be discarded.
"Unknown" section is always last