update repo
This commit is contained in:
38
traefik/traefik-certs-dumper/cmd/version.go
Normal file
38
traefik/traefik-certs-dumper/cmd/version.go
Normal file
@@ -0,0 +1,38 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user