Move config to separate package

This commit is contained in:
2021-08-04 12:04:01 +01:00
parent 2189ee511c
commit 8677f5bfdd
4 changed files with 77 additions and 68 deletions

19
config/command.go Normal file
View File

@@ -0,0 +1,19 @@
package config
import "os/exec"
type Command struct {
Program string
Arguments []string
AppendPayload bool
}
func (c Command) Execute(payload string) ([]byte, error) {
arguments := make([]string, 0)
copy(c.Arguments, arguments)
if c.AppendPayload {
arguments = append(arguments, payload)
}
return exec.Command(c.Program, arguments...).Output()
}