move debug tools

This commit is contained in:
Celogeek 2021-12-31 13:37:15 +01:00
parent 281530ce4c
commit b30ee9c7b8
Signed by: celogeek
GPG Key ID: E6B7BDCFC446233A
3 changed files with 7 additions and 7 deletions

View File

@ -5,8 +5,8 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/celogeek/piwigo-cli/internal/debug"
"github.com/celogeek/piwigo-cli/internal/piwigo" "github.com/celogeek/piwigo-cli/internal/piwigo"
"github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools"
) )
type MethodTryCommand struct { type MethodTryCommand struct {
@ -31,11 +31,11 @@ func (c *MethodTryCommand) Execute(args []string) error {
} }
if err := p.Post(c.MethodName, params, &result); err != nil { if err := p.Post(c.MethodName, params, &result); err != nil {
piwigotools.DumpResponse(params) debug.Dump(params)
return err return err
} }
piwigotools.DumpResponse(map[string]interface{}{ debug.Dump(map[string]interface{}{
"params": params, "params": params,
"result": result, "result": result,
}) })

View File

@ -1,11 +1,11 @@
package piwigotools package debug
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
) )
func DumpResponse(v interface{}) (err error) { func Dump(v interface{}) (err error) {
b, err := json.MarshalIndent(v, "", " ") b, err := json.MarshalIndent(v, "", " ")
if err == nil { if err == nil {
fmt.Println(string(b)) fmt.Println(string(b))

View File

@ -9,7 +9,7 @@ import (
"os" "os"
"strings" "strings"
"github.com/celogeek/piwigo-cli/internal/piwigo/piwigotools" "github.com/celogeek/piwigo-cli/internal/debug"
) )
type PiwigoResult struct { type PiwigoResult struct {
@ -98,7 +98,7 @@ func (p *Piwigo) Post(method string, form *url.Values, resp interface{}) error {
return err return err
} }
piwigotools.DumpResponse(RawResult) debug.Dump(RawResult)
} }
if Result.Stat != "ok" { if Result.Stat != "ok" {