package cmd import ( "fmt" "github.com/spf13/cobra" ) var ( // Version means the version of reverse Version = "0.1+dev" versionFlag *bool deployerCmd = &cobra.Command{ Version: Version, Use: "pr-deployer", Short: "PR-Deployer is a tool to help deploy PR", Long: `PR-Deployer is a tool to help deploy PR`, Run: func(cmd *cobra.Command, args []string) { if versionFlag != nil && *versionFlag { fmt.Printf("%s\n", Version) return } runWeb(cmd, args) }, } ) func init() { versionFlag = deployerCmd.Flags().BoolP("version", "v", false, "version of the tool") } // Execute represnets execute command func Execute() error { return deployerCmd.Execute() }