refactor: seperate files, function and structs into seperate packages

This commit is contained in:
Patryk Hegenberg 2025-01-18 14:34:16 +01:00
parent 7f951585c8
commit 5b7775f33e
37 changed files with 547 additions and 677 deletions

23
internal/shell/shell.go Normal file
View file

@ -0,0 +1,23 @@
package shell
import (
"fmt"
"os"
"os/exec"
)
var (
ExecCommand = exec.Command
ExecLookPath = exec.LookPath
)
func ExecuteShellCommand(command string, env string) error {
cmd := ExecCommand("bash", "-c", command)
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, env)
output, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("befehl fehlgeschlagen: %v\nAusgabe: %s", err, output)
}
return nil
}