Files
yutu/cmd/version.go
T
2024-03-13 10:17:25 +08:00

25 lines
494 B
Go

package cmd
import "github.com/spf13/cobra"
var (
Version string = ""
Commit string = ""
CommitDate string = ""
Os string = ""
Arch string = ""
)
var versionCmd = &cobra.Command{
Use: "version",
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, Commit, CommitDate, Os, Arch)
},
}
func init() {
RootCmd.AddCommand(versionCmd)
}