Skip to content

Commit

Permalink
kleiner release: allow to specify the version explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
can3p committed Jan 15, 2024
1 parent bf92c03 commit 54b1b71
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

func ReleaseCommand(buildinfo *types.BuildInfo) *cobra.Command {
var tagComment string
var versionOverride string

var releaseCmd = &cobra.Command{
Use: "release",
Expand Down Expand Up @@ -56,6 +57,17 @@ func ReleaseCommand(buildinfo *types.BuildInfo) *cobra.Command {
lastVersionStr = lastVersion.String()
}

if versionOverride != "" {
v, err := version.Parse(versionOverride)

if err != nil {
return err
}

fmt.Printf("Using [%s] as a new version\n", v.String())
newVersion = v
}

input := confirmation.New(
fmt.Sprintf("Do you want to release version [%s]? Last version is %s.", newVersion, lastVersionStr),
confirmation.No)
Expand Down Expand Up @@ -122,6 +134,7 @@ func ReleaseCommand(buildinfo *types.BuildInfo) *cobra.Command {
}

releaseCmd.Flags().StringVarP(&tagComment, "tag-comment", "m", "", "a message for the new tag")
releaseCmd.Flags().StringVarP(&versionOverride, "version", "v", "", "specify the version explicitly")
_ = releaseCmd.MarkFlagRequired("tag-comment")

return releaseCmd
Expand Down

0 comments on commit 54b1b71

Please sign in to comment.