I would like to embed helm inside a cli program that I'm writing
many cli programs, specially ones written using cobra, allow me to do that like this:
package tools
import (
k3d "github.com/k3d-io/k3d/v5/cmd"
"github.com/spf13/cobra"
kubectl "k8s.io/kubectl/pkg/cmd"
)
var ToolsCmd = &cobra.Command{
Use: "tools",
}
func init() {
ToolsCmd.AddCommand(k3d.NewCmdK3d())
ToolsCmd.AddCommand(kubectl.NewDefaultKubectlCommand())
RootCommand.AddCommand(ToolsCmd)
}
When I try to do the same for helm I get the flowing error:
import "helm.sh/helm/v3/cmd/helm" is a program, not an importable package
In order to support this for helm, the main file (named helm.go in this case) needs to be separated from the rest of the code.
I would like to embed
helminside a cli program that I'm writingmany cli programs, specially ones written using
cobra, allow me to do that like this:When I try to do the same for
helmI get the flowing error:In order to support this for
helm, the main file (namedhelm.goin this case) needs to be separated from the rest of the code.