commit 35a2038f0578687a6894b44e992d1d3ecdc92575 from: Oliver Lowe date: Sun Nov 03 22:21:57 2024 UTC Gitlab: add debug output flag commit - 521d393bafe7353136fd8b7742e2e30ae5a898ea commit + 35a2038f0578687a6894b44e992d1d3ecdc92575 blob - 16bfbc55e6c4131ab146b614d03342e6f232776d blob + a96afb7f4e632bd3da0b19b6ea904738787570c3 --- Gitlab/Gitlab.go +++ Gitlab/Gitlab.go @@ -377,11 +377,12 @@ var client *Client var hFlag = flag.String("h", "", "gitlab hostname") var tFlag = flag.String("t", "", "personal access token file") var pFlag = flag.String("p", "gitlab-org/gitlab", "project") +var debug = flag.Bool("d", false, "debug output") func main() { flag.Parse() log.SetFlags(0) - log.SetPrefix("Gitlab:") + log.SetPrefix("Gitlab: ") var tokenPath string if *tFlag != "" { tokenPath = *tFlag blob - 95e0b272a29a985a837859dff519e07fc9b730f1 blob + 307f833a8b21da6d3aedbef7768354edcab4000c --- Gitlab/client.go +++ Gitlab/client.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "net/url" "path" @@ -141,6 +142,9 @@ func (c *Client) do(req *http.Request) (*http.Response } req.Header.Set("Accept", "application/json") + if *debug { + log.Println(req.Method, req.URL) + } resp, err := c.Do(req) if err != nil { return nil, err