0
0
mirror of https://github.com/thegeeklab/wp-plugin-go.git synced 2024-11-22 00:20:38 +00:00

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

View File

@ -12,6 +12,9 @@ import (
"fmt" "fmt"
"net/http/httptrace" "net/http/httptrace"
"net/textproto" "net/textproto"
"os"
"os/exec"
"strings"
"github.com/rs/zerolog/log" "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, " "))
}