File tree 2 files changed +13
-13
lines changed
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) {
150
150
w .Write (content )
151
151
}
152
152
}
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
3
3
import (
4
4
"fmt"
5
5
"io"
6
-
7
- "github.com/rcmachado/changelog/chg"
6
+
8
7
"github.com/rcmachado/changelog/parser"
9
8
"github.com/spf13/cobra"
10
9
)
@@ -21,7 +20,7 @@ func newLatestCmd(iostreams *IOStreams) *cobra.Command {
21
20
cmd .SilenceUsage = true
22
21
return fmt .Errorf ("There are no versions in the changelog yet" )
23
22
}
24
- releasedVersions := releasedVersions ( changelog )
23
+ releasedVersions := changelog . ReleasedVersions ( )
25
24
if len (releasedVersions ) == 0 {
26
25
cmd .SilenceUsage = true
27
26
return fmt .Errorf ("There are no released versions in the changelog yet" )
@@ -31,13 +30,4 @@ func newLatestCmd(iostreams *IOStreams) *cobra.Command {
31
30
return nil
32
31
},
33
32
}
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