Files
swarm_stack/traefik/traefik-certs-dumper/cmd/version.go
ministicraft 8ed9113bb2 update repo
2019-06-04 22:58:42 +02:00

39 lines
694 B
Go

package cmd
import (
"fmt"
"runtime"
"github.com/spf13/cobra"
)
var (
version = "dev"
commit = "I don't remember exactly"
date = "I don't remember exactly"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Display version",
Run: func(cmd *cobra.Command, args []string) {
displayVersion(rootCmd.Name())
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}
func displayVersion(name string) {
fmt.Printf(name+`:
version : %s
commit : %s
build date : %s
go version : %s
go compiler : %s
platform : %s/%s
`, version, commit, date, runtime.Version(), runtime.Compiler, runtime.GOOS, runtime.GOARCH)
}