dispatch/commands/version.go
2018-11-26 01:58:24 +01:00

22 lines
451 B
Go

package commands
import (
"fmt"
"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\n", version.Tag, version.Commit, version.Date)
}