File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -150,3 +150,13 @@ func (c *Changelog) Render(w io.Writer) {
150150 w .Write (content )
151151 }
152152}
153+
154+ func (c * Changelog ) ReleasedVersions () []Version {
155+ var result []Version
156+ for _ , version := range c .Versions {
157+ if version .Name != "Unreleased" {
158+ result = append (result , * version )
159+ }
160+ }
161+ return result
162+ }
Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ package cmd
33import (
44 "fmt"
55 "io"
6-
7- "github.com/rcmachado/changelog/chg"
6+
87 "github.com/rcmachado/changelog/parser"
98 "github.com/spf13/cobra"
109)
@@ -21,7 +20,7 @@ func newLatestCmd(iostreams *IOStreams) *cobra.Command {
2120 cmd .SilenceUsage = true
2221 return fmt .Errorf ("There are no versions in the changelog yet" )
2322 }
24- releasedVersions := releasedVersions ( changelog )
23+ releasedVersions := changelog . ReleasedVersions ( )
2524 if len (releasedVersions ) == 0 {
2625 cmd .SilenceUsage = true
2726 return fmt .Errorf ("There are no released versions in the changelog yet" )
@@ -31,13 +30,4 @@ func newLatestCmd(iostreams *IOStreams) *cobra.Command {
3130 return nil
3231 },
3332 }
34- }
35-
36- func releasedVersions (changelog * chg.Changelog ) (result []chg.Version ) {
37- for _ , version := range changelog .Versions {
38- if version .Name != "Unreleased" {
39- result = append (result , * version )
40- }
41- }
42- return
43- }
33+ }
You can’t perform that action at this time.
0 commit comments