-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbump.go
More file actions
34 lines (29 loc) · 771 Bytes
/
bump.go
File metadata and controls
34 lines (29 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Copyright © 2024 Koen van Zuijlen <[email protected]>
*/
package cmd
import (
"fmt"
"github.com/version-cli/version/pkg/versioning/semver"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
var bumpCmd = &cobra.Command{
Use: "bump VERSION",
Aliases: []string{"next"},
Short: "Bumps the specified version number",
Long: `Bumps the specified version number with the specified version level.
Can also be used to bump multiple levels with the --number flag`,
RunE: func(_ *cobra.Command, args []string) (err error) {
version, err := semver.Bump(args[0], versionLevel, count)
if err != nil {
zap.L().Error(err.Error())
return err
}
fmt.Println(version)
return nil
},
}
func init() {
rootCmd.AddCommand(bumpCmd)
}