func New(helmBinary string, logger *zap.SugaredLogger, kubeContext string, runner Runner) *execer {
	version, err := getHelmVersion(helmBinary, runner)
	if err != nil {
		panic(err)
	}
	return &execer{
		helmBinary:       helmBinary,
		version:          version,
		logger:           logger,
		kubeContext:      kubeContext,
		runner:           runner,
		decryptedSecrets: make(map[string]*decryptedSecret),
	}
}
New for running helm commands
package helmexec
import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"sync"
	"github.com/Masterminds/semver/v3"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)
type decryptedSecret struct {
	mutex sync.RWMutex
	bytes []byte
	err   error
}
type execer struct {
	helmBinary           string
	version              semver.Version
	runner               Runner
	logger               *zap.SugaredLogger
	kubeContext          string
	extra                []string
	decryptedSecretMutex sync.Mutex
	decryptedSecrets     map[string]*decryptedSecret
	writeTempFile        func([]byte) (string, error)
}
func NewLogger(writer io.Writer, logLevel string) *zap.SugaredLogger {
	var cfg zapcore.EncoderConfig
	cfg.MessageKey = "message"
	out := zapcore.AddSync(writer)
	var level zapcore.Level
	err := level.Set(logLevel)
	if err != nil {
		panic(err)
	}
	core := zapcore.NewCore(
		zapcore.NewConsoleEncoder(cfg),
		out,
		level,
	)
	return zap.New(core).Sugar()
}
func parseHelmVersion(versionStr string) (semver.Version, error) {
	if len(versionStr) == 0 {
		return semver.Version{}, nil
	}
	versionStr = strings.TrimLeft(versionStr, "Client: ")
	versionStr = strings.TrimRight(versionStr, "\n")
	ver, err := semver.NewVersion(versionStr)
	if err != nil {
		return semver.Version{}, fmt.Errorf("error parsing helm version '%s'", versionStr)
	}
	if os.Getenv("HELMFILE_HELM3") != "" && ver.Major() < 3 {
		return *semver.MustParse("v3.0.0"), nil
	}
	return *ver, nil
}
func getHelmVersion(helmBinary string, runner Runner) (semver.Version, error) {
	outBytes, err := runner.Execute(helmBinary, []string{"version", "--client", "--short"}, nil)
	if err != nil {
		return semver.Version{}, fmt.Errorf("error determining helm version: %w", err)
	}
	return parseHelmVersion(string(outBytes))
}