Files
oc-deploy/src/helm/version.go

21 lines
330 B
Go
Raw Normal View History

2024-09-02 11:44:44 +00:00
package helm
import (
"strings"
"os/exec"
)
func Version(path string) (string, error) {
2024-09-04 07:11:13 +00:00
cmd := exec.Command(path, "version", "--short")
stdout, err := cmd.CombinedOutput()
2024-09-02 11:44:44 +00:00
if err != nil {
return "", err
}
2024-09-04 07:11:13 +00:00
res := string(stdout)
res = strings.TrimSuffix(res, "\n")
2024-09-02 11:44:44 +00:00
return res, nil
}