feat: add cmd trace method (#47)

This commit is contained in:
Robert Kaussow 2024-01-01 21:42:17 +01:00 committed by GitHub
parent ddde4d726e
commit 5dce9de670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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, " "))
}