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

View File

@ -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))

View File

@ -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" {