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"
|
"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,
|
||||||
})
|
})
|
||||||
|
@ -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))
|
@ -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" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user