You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/cmd/version.go

34 lines
872 B
Go

package cmd
import (
"fmt"
"runtime"
"runtime/debug"
"github.com/spf13/cobra"
"github.com/synctv-org/synctv/internal/version"
)
var VersionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of Sync TV Server",
Long: `All software has versions. This is Sync TV Server's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("synctv %s\n", version.Version)
fmt.Printf("- git/commit: %s\n", version.GitCommit)
fmt.Printf("- os/platform: %s\n", runtime.GOOS)
fmt.Printf("- os/arch: %s\n", runtime.GOARCH)
fmt.Printf("- go/version: %s\n", runtime.Version())
fmt.Printf("- go/compiler: %s\n", runtime.Compiler)
fmt.Printf("- go/numcpu: %d\n", runtime.NumCPU())
info, ok := debug.ReadBuildInfo()
if ok {
fmt.Printf("- go/buildsettings: %v\n", info.Settings)
}
},
}
func init() {
RootCmd.AddCommand(VersionCmd)
}