bashhub-server/cmd/version.go
2020-02-07 18:51:31 -05:00

25 lines
669 B
Go

package cmd
import (
"fmt"
"github.com/nicksherron/bashhub-server/version"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of generated code example",
Long: `All software has versions. This is generated code example`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Build Date:", version.BuildDate)
fmt.Println("Git Commit:", version.GitCommit)
fmt.Println("Version:", version.Version)
fmt.Println("Go Version:", version.GoVersion)
fmt.Println("OS / Arch:", version.OsArch)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}