Skip to content

Commit

Permalink
Merge pull request #66 from barryib/add-upper-first-func
Browse files Browse the repository at this point in the history
feat: add upperFirst template function
  • Loading branch information
wadackel committed Apr 9, 2020
2 parents 2cabbd3 + 495fa2d commit c1c1fe8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
42 changes: 40 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions chglog.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ func (gen *Generator) render(w io.Writer, unreleased *Unreleased, versions []*Ve
"upper": func(s string) string {
return strings.ToUpper(s)
},
// upper case the first character of a string
"upperFirst": func(s string) string {
if len(s) > 0 {
return strings.ToUpper(string(s[0])) + s[1:]
}
return ""
},
}

fname := filepath.Base(gen.config.Template)
Expand Down
8 changes: 4 additions & 4 deletions tag_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ func TestTagReader(t *testing.T) {
assert.Equal(
[]*Tag{
&Tag{
Name: "v2.0.4-beta.1",
Subject: "Release v2.0.4-beta.1",
Date: time.Date(2018, 2, 1, 0, 0, 0, 0, time.UTC),
Next: nil,
Name: "v2.0.4-beta.1",
Subject: "Release v2.0.4-beta.1",
Date: time.Date(2018, 2, 1, 0, 0, 0, 0, time.UTC),
Next: nil,
Previous: nil,
},
},
Expand Down

0 comments on commit c1c1fe8

Please sign in to comment.