teldrive/cmd/version.go

23 lines
502 B
Go
Raw Permalink Normal View History

package cmd
2024-02-13 00:02:55 +08:00
import (
"runtime"
"github.com/spf13/cobra"
2024-08-31 23:50:17 +08:00
"github.com/tgdrive/teldrive/internal/config"
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 {
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
},
}
}