Implement Stringer in Command type

This commit is contained in:
Akbar Rahman 2021-08-06 14:29:24 +01:00
parent 87ea4cc5e5
commit cf65488907

View File

@ -1,6 +1,9 @@
package config package config
import "os/exec" import (
"fmt"
"os/exec"
)
type Command struct { type Command struct {
Program string Program string
@ -17,3 +20,11 @@ func (c Command) Execute(payload string) ([]byte, error) {
return exec.Command(c.Program, arguments...).Output() return exec.Command(c.Program, arguments...).Output()
} }
func (c Command) String() string {
return fmt.Sprintf(
"<Command cmd=%v AppendPayload=%v>",
append([]string{c.Program}, c.Arguments...),
c.AppendPayload,
)
}