💬 Update version output

This commit is contained in:
chaoqun committed 2024-05-30 22:56:53 +08:00
1 parent fbe3449bce
commit 3daf01a6c8
3 files changed
+19 -2

No files matched your search

+16 -2
View File
@@ -1,6 +1,9 @@
package cmd
import "github.com/spf13/cobra"
import (
"github.com/savioxavier/termlink"
"github.com/spf13/cobra"
)
var (
Version = ""
@@ -8,6 +11,7 @@ var (
CommitDate = ""
Os = ""
Arch = ""
repo = "https://github.com/eat-pray-ai/yutu"
)
var versionCmd = &cobra.Command{
@@ -15,7 +19,17 @@ var versionCmd = &cobra.Command{
Short: "Show the version of yutu",
Long: "Show the version of yutu",
Run: func(cmd *cobra.Command, args []string) {
cmd.Printf("yutu version %s %s/%s\nbuild %s-%s\n", Version, Os, Arch, Commit, CommitDate)
cmd.Printf("yutu🐰 version %s", Version)
if Os != "" && Arch != "" {
cmd.Printf(" %s/%s", Os, Arch)
}
if Commit != "" && CommitDate != "" {
cmd.Printf("\nbuild %s-%s", Commit, CommitDate)
}
cmd.Println()
cmd.Println("Star🌟:", termlink.Link("Github/eat-pray-ai/yutu", repo))
},
}
+1
View File
@@ -19,6 +19,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/savioxavier/termlink v1.3.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
+2
View File
@@ -95,6 +95,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/savioxavier/termlink v1.3.0 h1:3Gl4FzQjUyiHzmoEDfmWEhgIwDiJY4poOQHP+k8ReA4=
github.com/savioxavier/termlink v1.3.0/go.mod h1:5T5ePUlWbxCHIwyF8/Ez1qufOoGM89RCg9NvG+3G3gc=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=