github.com/azunymous/cdx@v0.0.0-20201122180449-fbb46cc4d252/cmd/cdx/cdx.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "github.com/azunymous/cdx/commands" 6 "github.com/spf13/cobra" 7 "os" 8 ) 9 10 func main() { 11 var rootCmd = &cobra.Command{ 12 Use: "cdx", 13 Short: "continous deployment tooling", 14 Long: `Tooling and scripts for continous deployment`, 15 Version: version, 16 } 17 18 rootCmd.SetVersionTemplate(versionTemplate()) 19 commands.AddCommands(rootCmd) 20 if err := rootCmd.Execute(); err != nil { 21 fmt.Println(err) 22 os.Exit(1) 23 } 24 } 25 26 func versionTemplate() string { 27 return `{{with .Name}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} 28 Git Hash: ` + gitHash + ` 29 Time: ` + buildTime + ` UTC 30 ` 31 }