Force namespace via cmdline parameter (#53)

* Force name via cmdline parameter

* Use a library to parse CLI flags

* Use less env vars

* Document it
This commit is contained in:
Andrey Pokhilko
2022-10-28 12:39:19 +01:00
committed by GitHub
parent d9edcf2f48
commit 786bddc478
8 changed files with 93 additions and 30 deletions

View File

@@ -34,7 +34,7 @@ func TempFile(txt string) (string, func(), error) {
return "", nil, err
}
return file.Name(), func() { os.Remove(file.Name()) }, nil
return file.Name(), func() { _ = os.Remove(file.Name()) }, nil
}
type CmdError struct {
@@ -49,6 +49,7 @@ func (e CmdError) Error() string {
}
func RunCommand(cmd []string, env map[string]string) (string, error) {
log.Debugf("Starting command: %s", cmd)
prog := exec.Command(cmd[0], cmd[1:]...)
prog.Env = os.Environ()