fix: coco version

This commit is contained in:
Young Xu 2024-04-06 12:48:27 +08:00
parent f656fdfce8
commit bdc3dc9077
Signed by: xuthus5
GPG Key ID: A23CF9620CBB55F9
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@ package bootstrap
import (
"fmt"
"time"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -25,7 +26,7 @@ func AddVersionCommand() *cobra.Command {
}
configPath = rt.ReplaceEachSlash(fmt.Sprintf("%s/.coco.yaml", rt.GetHomeDir()))
_ = easyaml.Read(configPath, &config)
logrus.Infof("current version: %s, release at: %s", config.Version, config.CommitAt)
logrus.Infof("current version: %s, release at: %s", config.Version, config.CommitAt.Format(time.DateTime))
},
Run: func(cmd *cobra.Command, args []string) {
client, err := NewGiteaClient("https://gitter.top")
@ -44,7 +45,7 @@ func AddVersionCommand() *cobra.Command {
}
var commitID = commit.SHA[:8]
logrus.Infof("latest version: %s, release at: %s", commitID, commit.CommitMeta.Created)
logrus.Infof("latest version: %s, release at: %s", commitID, commit.CommitMeta.Created.Format(time.DateTime))
if update {
repo := fmt.Sprintf("gitter.top/coco/bootstrap/coco/...@%s", commitID)
@ -63,6 +64,6 @@ func AddVersionCommand() *cobra.Command {
}
},
}
cmd.Flags().BoolVar(&update, "update", true, "update coco version")
cmd.Flags().BoolVar(&update, "update", false, "update coco version")
return cmd
}