@@ -24,8 +24,10 @@ import (
2424 "path/filepath"
2525 "regexp"
2626 "sort"
27+ "strings"
2728 "text/tabwriter"
2829 "text/template"
30+ "unicode"
2931
3032 "github.com/pkg/errors"
3133 "github.com/sirupsen/logrus"
@@ -84,6 +86,7 @@ type release struct {
8486 Changes []projectChange
8587 Contributors []string
8688 Dependencies []dependency
89+ Tag string
8790 Version string
8891 Downloads []download
8992}
@@ -105,16 +108,24 @@ This tool should be ran from the root of the project repository for a new releas
105108 Usage : "show debug output" ,
106109 },
107110 cli.StringFlag {
108- Name : "template,t" ,
111+ Name : "tag,t" ,
112+ Usage : "tag name for the release, defaults to release file name" ,
113+ },
114+ cli.StringFlag {
115+ Name : "template" ,
109116 Usage : "template filepath to use in place of the default" ,
110117 Value : defaultTemplateFile ,
111118 },
112119 }
113120 app .Action = func (context * cli.Context ) error {
114121 var (
115122 releasePath = context .Args ().First ()
116- tag = parseTag ( releasePath )
123+ tag = context . String ( "tag" )
117124 )
125+ if tag == "" {
126+ tag = parseTag (releasePath )
127+ }
128+ version := strings .TrimLeft (tag , "v" )
118129 if context .Bool ("debug" ) {
119130 logrus .SetLevel (logrus .DebugLevel )
120131 }
@@ -226,7 +237,11 @@ This tool should be ran from the root of the project repository for a new releas
226237 r .Contributors = orderContributors (contributors )
227238 r .Dependencies = updatedDeps
228239 r .Changes = projectChanges
229- r .Version = tag
240+ r .Tag = tag
241+ r .Version = version
242+
243+ // Remove trailing new lines
244+ r .Preface = strings .TrimRightFunc (r .Preface , unicode .IsSpace )
230245
231246 tmpl , err := getTemplate (context )
232247 if err != nil {
0 commit comments