From 5dce9de6708df49e1f5a5b6a9228e43272a0a90f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 1 Jan 2024 21:42:17 +0100 Subject: [PATCH] feat: add cmd trace method (#47) --- trace/http.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/trace/http.go b/trace/http.go index 2f2a065..0624922 100644 --- a/trace/http.go +++ b/trace/http.go @@ -12,6 +12,9 @@ import ( "fmt" "net/http/httptrace" "net/textproto" + "os" + "os/exec" + "strings" "github.com/rs/zerolog/log" ) @@ -117,3 +120,8 @@ func HTTP(ctx context.Context) context.Context { }, }) } + +// Cmd prints the executed command to stdout. +func Cmd(cmd *exec.Cmd) { + fmt.Fprintf(os.Stdout, "+ %s\n", strings.Join(cmd.Args, " ")) +}