dev-centralize #1

Merged
jantytgat merged 11 commits from dev-centralize into main 2025-06-09 19:13:38 +00:00
28 changed files with 1129 additions and 24 deletions
Showing only changes of commit 00078e09be - Show all commits

View File

@ -5,8 +5,6 @@ import (
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"git.flexabyte.io/flexabyte/go-kit/semver"
) )
const ( const (
@ -48,10 +46,10 @@ func configureVersionFlag(cmd *cobra.Command, v Version) {
addVersionFlag(cmd) addVersionFlag(cmd)
} }
func printVersion(v semver.Version) string { func printVersion(v Version) string {
var output string var output string
if !verboseFlag { if !verboseFlag {
output = v.String() output = v.Full
} }
if jsonOutputFlag { if jsonOutputFlag {
@ -65,27 +63,20 @@ func printVersion(v semver.Version) string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"Full: %s\nBranch: %s\nTag: %s\nCommit: %s\nCommit date: %s\nBuild date: %s\nMajor: %s\nMinor: %s\nPatch: %s\nPreRelease: %s\n", "Full: %s\nBranch: %s\nTag: %s\nCommit: %s\nCommit date: %s\nBuild date: %s\nMajor: %s\nMinor: %s\nPatch: %s\nPreRelease: %s\n",
version.Full, v.Full,
version.Branch, v.Branch,
version.Tag, v.Tag,
version.Commit, v.Commit,
version.CommitDate, v.CommitDate,
version.BuildDate, v.BuildDate,
version.Major, v.Major,
version.Minor, v.Minor,
version.Patch, v.Patch,
version.PreRelease, v.PreRelease,
) )
} }
func versionRunFuncE(cmd *cobra.Command, args []string) error { func versionRunFuncE(cmd *cobra.Command, args []string) error {
var v semver.Version _, err := fmt.Fprintln(outWriter, printVersion(version))
var err error
if v, err = semver.Parse(version.Full); err != nil {
return err return err
} }
if _, err = fmt.Fprintln(outWriter, printVersion(v)); err != nil {
return err
}
return nil
}