github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/src/cmd/tools/helm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // SPDX-FileCopyrightText: 2021-Present The Jackal Authors
     3  
     4  // Package tools contains the CLI commands for Jackal.
     5  package tools
     6  
     7  import (
     8  	"os"
     9  
    10  	"github.com/Racer159/jackal/src/cmd/tools/helm"
    11  	"github.com/Racer159/jackal/src/config/lang"
    12  	"helm.sh/helm/v3/pkg/action"
    13  )
    14  
    15  // ldflags github.com/Racer159/jackal/src/cmd/tools.helmVersion=x.x.x
    16  var helmVersion string
    17  
    18  func init() {
    19  	actionConfig := new(action.Configuration)
    20  
    21  	// Truncate Helm's arguments so that it thinks its all alone
    22  	helmArgs := []string{}
    23  	if len(os.Args) > 2 {
    24  		helmArgs = os.Args[3:]
    25  	}
    26  	// The inclusion of Helm in this manner should be changed once https://github.com/helm/helm/pull/12725 is merged
    27  	helmCmd, _ := helm.NewRootCmd(actionConfig, os.Stdout, helmArgs)
    28  	helmCmd.Short = lang.CmdToolsHelmShort
    29  	helmCmd.Long = lang.CmdToolsHelmLong
    30  	helmCmd.AddCommand(newVersionCmd("helm", helmVersion))
    31  
    32  	toolsCmd.AddCommand(helmCmd)
    33  }