teldrive/cmd/version.go

23 lines
504 B
Go
Raw Normal View History

package cmd
2024-02-13 00:02:55 +08:00
import (
"runtime"
"github.com/divyam234/teldrive/internal/config"
2024-02-13 00:02:55 +08:00
"github.com/spf13/cobra"
)
func NewVersion() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Check the version info",
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Printf("teldrive %s\n", config.Version)
2024-02-13 00:02:55 +08:00
cmd.Printf("- os/type: %s\n", runtime.GOOS)
cmd.Printf("- os/arch: %s\n", runtime.GOARCH)
cmd.Printf("- go/version: %s\n", runtime.Version())
return nil
},
}
}