35 lines
814 B
Go
35 lines
814 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
version = "dev"
|
|
commit = "unknown"
|
|
buildTime = "unknown"
|
|
)
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Show version information",
|
|
Long: `Display version, build time, and other build information for FastestMirror.`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Printf("FastestMirror %s\n", version)
|
|
fmt.Printf("Git Commit: %s\n", commit)
|
|
fmt.Printf("Build Time: %s\n", buildTime)
|
|
fmt.Printf("Go Version: %s\n", runtime.Version())
|
|
fmt.Printf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
|
fmt.Println()
|
|
fmt.Println("Repository: https://git.gostacks.org/iwasforcedtobehere/fastestmirror")
|
|
fmt.Println("Author: @iwasforcedtobehere")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
}
|