dispatch/commands/version.go
Ken-Håvard Lieng c5a9a5b1c1 Print go version
2018-12-15 11:30:29 +01:00

23 lines
494 B
Go

package commands
import (
"fmt"
"runtime"
"github.com/khlieng/dispatch/version"
"github.com/spf13/cobra"
)
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show version",
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {
printVersion()
},
}
func printVersion() {
fmt.Printf("%s\nCommit: %s\nBuild Date: %s\nRuntime: %s\n", version.Tag, version.Commit, version.Date, runtime.Version())
}