mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
move debug tools
This commit is contained in:
parent
281530ce4c
commit
b30ee9c7b8
@ -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,
|
||||
})
|
||||
|
@ -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))
|
@ -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" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user