teldrive/cmd/version.go

23 lines
542 B
Go
Raw Normal View History

package cmd
2024-02-13 00:02:55 +08:00
import (
"github.com/spf13/cobra"
2025-01-11 22:08:57 +08:00
"github.com/tgdrive/teldrive/internal/version"
2024-02-13 00:02:55 +08:00
)
func NewVersion() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Check the version info",
RunE: func(cmd *cobra.Command, args []string) error {
2025-01-11 22:08:57 +08:00
v := version.GetVersionInfo()
cmd.Printf("teldrive %s\n", v.Version)
cmd.Printf("- commit: %s\n", v.CommitSHA)
cmd.Printf("- os/type: %s\n", v.Os)
cmd.Printf("- os/arch: %s\n", v.Arch)
cmd.Printf("- go/version: %s\n", v.GoVersion)
2024-02-13 00:02:55 +08:00
return nil
},
}
}