github.com/jenkins-x/jx/v2@v2.1.155/pkg/cmd/get/get_helmbin.go (about) 1 package get 2 3 import ( 4 "github.com/jenkins-x/jx-logging/pkg/log" 5 "github.com/jenkins-x/jx/v2/pkg/cmd/helper" 6 "github.com/jenkins-x/jx/v2/pkg/cmd/opts" 7 "github.com/jenkins-x/jx/v2/pkg/cmd/templates" 8 "github.com/jenkins-x/jx/v2/pkg/util" 9 "github.com/spf13/cobra" 10 ) 11 12 // GetHelmBinOptions containers the CLI options 13 type GetHelmBinOptions struct { 14 Options 15 } 16 17 var ( 18 getHelmBinLong = templates.LongDesc(` 19 Display the Helm binary name used in pipelines. 20 21 This setting lets you switch from the stable release to early access releases (e.g. from Helm 2 <-> 3) 22 `) 23 24 getHelmBinExample = templates.Examples(` 25 # List the git branch patterns for the current team 26 jx get helmbin 27 `) 28 ) 29 30 // NewCmdGetHelmBin creates the new command for: jx get env 31 func NewCmdGetHelmBin(commonOpts *opts.CommonOptions) *cobra.Command { 32 options := &GetHelmBinOptions{ 33 Options: Options{ 34 CommonOptions: commonOpts, 35 }, 36 } 37 cmd := &cobra.Command{ 38 Use: "helmbin", 39 Short: "Display the Helm binary name used in the pipelines", 40 Aliases: []string{"helm"}, 41 Long: getHelmBinLong, 42 Example: getHelmBinExample, 43 Run: func(cmd *cobra.Command, args []string) { 44 options.Cmd = cmd 45 options.Args = args 46 err := options.Run() 47 helper.CheckErr(err) 48 }, 49 } 50 51 options.AddGetFlags(cmd) 52 return cmd 53 } 54 55 // Run implements this command 56 func (o *GetHelmBinOptions) Run() error { 57 helm, _, _, err := o.TeamHelmBin() 58 if err != nil { 59 return err 60 } 61 log.Logger().Infof("Your team uses the helm binary: %s", util.ColorInfo(helm)) 62 log.Logger().Infof("To change this value use: %s", util.ColorInfo("jx edit helmbin helm3")) 63 return nil 64 }