Skip to content
Snippets Groups Projects
Commit 79f1a369 authored by timoknapp's avatar timoknapp Committed by Christoph Witzko
Browse files

chore: now also check for changelog config 'prettify' flag

parent ecdd4af7
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,21 @@ func formatCommit(c *semrel.Commit) string { ...@@ -27,9 +27,21 @@ func formatCommit(c *semrel.Commit) string {
var CGVERSION = "dev" var CGVERSION = "dev"
type DefaultChangelogGenerator struct{} type DefaultChangelogGenerator struct {
prettifyOutput bool
}
func (g *DefaultChangelogGenerator) Init(m map[string]string) error { func (g *DefaultChangelogGenerator) Init(m map[string]string) error {
prettifyOutput := false
prettifyConfig := m["prettify"]
if prettifyConfig == "true" {
prettifyOutput = true
}
g.prettifyOutput = prettifyOutput
return nil return nil
} }
...@@ -41,7 +53,7 @@ func (g *DefaultChangelogGenerator) Version() string { ...@@ -41,7 +53,7 @@ func (g *DefaultChangelogGenerator) Version() string {
return CGVERSION return CGVERSION
} }
func (*DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogGeneratorConfig) string { func (g *DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogGeneratorConfig) string {
ret := fmt.Sprintf("## %s (%s)\n\n", changelogConfig.NewVersion, time.Now().UTC().Format("2006-01-02")) ret := fmt.Sprintf("## %s (%s)\n\n", changelogConfig.NewVersion, time.Now().UTC().Format("2006-01-02"))
clTypes := NewChangelogTypes() clTypes := NewChangelogTypes()
for _, commit := range changelogConfig.Commits { for _, commit := range changelogConfig.Commits {
...@@ -62,7 +74,11 @@ func (*DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogG ...@@ -62,7 +74,11 @@ func (*DefaultChangelogGenerator) Generate(changelogConfig *generator.ChangelogG
if ct.Content == "" { if ct.Content == "" {
continue continue
} }
ret += fmt.Sprintf("#### %s\n\n%s\n", ct.Text, ct.Content) prettifyPrefix := ""
if g.prettifyOutput {
prettifyPrefix = ct.Emoji
}
ret += fmt.Sprintf("#### %s%s\n\n%s\n", prettifyPrefix, ct.Text, ct.Content)
} }
return ret return ret
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment