Add 'custom' module

This commit is contained in:
2025-12-22 11:54:30 +02:00
parent 9ce8e5ef0b
commit c7bfaf7a31
4 changed files with 69 additions and 64 deletions
+16
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"math"
"os"
"os/exec"
"regexp"
"strings"
)
@@ -56,3 +57,18 @@ func ReadKeyValueFile(filepath string) (map[string]string, error) {
}
return ret, nil
}
func runCommand(command string, shell string) string {
cmd := exec.Command(shell, "-c", command)
workdir, err := os.Getwd()
if err != nil {
return ""
}
cmd.Dir = workdir
cmd.Env = os.Environ()
out, err := cmd.Output()
if err != nil {
return ""
}
return strings.TrimSpace(string(out))
}