2018-11-26 00:49:16 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2018-12-15 10:30:29 +00:00
|
|
|
"runtime"
|
2018-11-26 00:49:16 +00:00
|
|
|
|
|
|
|
"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() {
|
2018-12-15 10:30:29 +00:00
|
|
|
fmt.Printf("%s\nCommit: %s\nBuild Date: %s\nRuntime: %s\n", version.Tag, version.Commit, version.Date, runtime.Version())
|
2018-11-26 00:49:16 +00:00
|
|
|
}
|