init bin
This commit is contained in:
20
src/helm/version.go
Normal file
20
src/helm/version.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package helm
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func Version(path string) (string, error) {
|
||||
|
||||
cmd := exec.Command(path, "version", "--short")
|
||||
stdout, err := cmd.CombinedOutput()
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
res := string(stdout)
|
||||
res = strings.TrimSuffix(res, "\n")
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user