diff --git a/cmd/piwigo-cli/method_try.go b/cmd/piwigo-cli/method_try.go index e784763..1a46d67 100644 --- a/cmd/piwigo-cli/method_try.go +++ b/cmd/piwigo-cli/method_try.go @@ -5,8 +5,8 @@ import ( "net/url" "strings" + "github.com/celogeek/piwigo-cli/internal/debug" "github.com/celogeek/piwigo-cli/internal/piwigo" - "github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools" ) type MethodTryCommand struct { @@ -31,11 +31,11 @@ func (c *MethodTryCommand) Execute(args []string) error { } if err := p.Post(c.MethodName, params, &result); err != nil { - piwigotools.DumpResponse(params) + debug.Dump(params) return err } - piwigotools.DumpResponse(map[string]interface{}{ + debug.Dump(map[string]interface{}{ "params": params, "result": result, }) diff --git a/internal/piwigo/piwigotools/dump.go b/internal/debug/dump.go similarity index 66% rename from internal/piwigo/piwigotools/dump.go rename to internal/debug/dump.go index 6ec10dd..8994f77 100644 --- a/internal/piwigo/piwigotools/dump.go +++ b/internal/debug/dump.go @@ -1,11 +1,11 @@ -package piwigotools +package debug import ( "encoding/json" "fmt" ) -func DumpResponse(v interface{}) (err error) { +func Dump(v interface{}) (err error) { b, err := json.MarshalIndent(v, "", " ") if err == nil { fmt.Println(string(b)) diff --git a/internal/piwigo/post.go b/internal/piwigo/post.go index 5f8fbb5..d5a0457 100644 --- a/internal/piwigo/post.go +++ b/internal/piwigo/post.go @@ -9,7 +9,7 @@ import ( "os" "strings" - "github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools" + "github.com/celogeek/piwigo-cli/internal/debug" ) type PiwigoResult struct { @@ -98,7 +98,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error { return err } - piwigotools.DumpResponse(RawResult) + debug.Dump(RawResult) } if Result.Stat != "ok" {