From cf654889071b2e04597c517dd86f21829a34d6af Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Fri, 6 Aug 2021 14:29:24 +0100 Subject: [PATCH] Implement Stringer in Command type --- config/command.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/command.go b/config/command.go index 1e02728..32311f8 100644 --- a/config/command.go +++ b/config/command.go @@ -1,6 +1,9 @@ package config -import "os/exec" +import ( + "fmt" + "os/exec" +) type Command struct { Program string @@ -17,3 +20,11 @@ func (c Command) Execute(payload string) ([]byte, error) { return exec.Command(c.Program, arguments...).Output() } + +func (c Command) String() string { + return fmt.Sprintf( + "", + append([]string{c.Program}, c.Arguments...), + c.AppendPayload, + ) +}