aboutsummaryrefslogtreecommitdiffhomepage
path: root/commands/release.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2017-07-05 10:23:07 +0200
committerBjørn Erik Pedersen <[email protected]>2017-07-05 14:27:43 +0200
commit5f831a622337d6a1d33a28a21391ba682030f21f (patch)
treea00afceacf5fb0d4460403c3f884da7c60a30195 /commands/release.go
parente7a54e7afc21e647adc035b592638c77c8219fe2 (diff)
downloadhugo-5f831a622337d6a1d33a28a21391ba682030f21f.tar.gz
hugo-5f831a622337d6a1d33a28a21391ba682030f21f.zip
releaser: Replace the magic version handling
Take the new version as a string value.
Diffstat (limited to 'commands/release.go')
-rw-r--r--commands/release.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/commands/release.go b/commands/release.go
index 74dc7012e..0764685f0 100644
--- a/commands/release.go
+++ b/commands/release.go
@@ -16,6 +16,8 @@
package commands
import (
+ "errors"
+
"github.com/gohugoio/hugo/releaser"
"github.com/spf13/cobra"
)
@@ -27,8 +29,7 @@ func init() {
type releaseCommandeer struct {
cmd *cobra.Command
- // Will be zero for main releases.
- patchLevel int
+ version string
skipPublish bool
try bool
@@ -51,7 +52,7 @@ func createReleaser() *releaseCommandeer {
return r.release()
}
- r.cmd.PersistentFlags().IntVarP(&r.patchLevel, "patch", "p", 0, "patch level, defaults to 0 for main releases")
+ r.cmd.PersistentFlags().StringVarP(&r.version, "rel", "r", "", "new release version, i.e. 0.25.1")
r.cmd.PersistentFlags().IntVarP(&r.step, "step", "s", -1, "release step, defaults to -1 for all steps.")
r.cmd.PersistentFlags().BoolVarP(&r.skipPublish, "skip-publish", "", false, "skip all publishing pipes of the release")
r.cmd.PersistentFlags().BoolVarP(&r.try, "try", "", false, "simulate a release, i.e. no changes")
@@ -60,5 +61,8 @@ func createReleaser() *releaseCommandeer {
}
func (r *releaseCommandeer) release() error {
- return releaser.New(r.patchLevel, r.step, r.skipPublish, r.try).Run()
+ if r.version == "" {
+ return errors.New("must set the --rel flag to the relevant version number")
+ }
+ return releaser.New(r.version, r.step, r.skipPublish, r.try).Run()
}