WIP
This commit is contained in:
parent
ea93d6de45
commit
d01dff5774
@ -21,11 +21,11 @@ func (pc *PluginClient) Do(ctx context.Context, commandName string, args map[str
|
||||
CommandName: commandName,
|
||||
Args: args,
|
||||
}
|
||||
doReq, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = pc.client.Call("Plugin.Do", doReq, new(any))
|
||||
//doReq, err := json.Marshal(req)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
err := pc.client.Call("Plugin.Do", req, new(any))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -3,27 +3,27 @@ package register
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type PluginServer struct {
|
||||
Impl Plugin
|
||||
}
|
||||
|
||||
func (ps *PluginServer) Do(args any, resp *string) error {
|
||||
rawReq, ok := args.(string)
|
||||
if !ok {
|
||||
return errors.New("args is not a string")
|
||||
}
|
||||
func (ps *PluginServer) Do(args *DoRequest, resp *string) error {
|
||||
//rawReq, ok := args.(string)
|
||||
//if !ok {
|
||||
// return errors.New("args is not a string")
|
||||
//}
|
||||
|
||||
var doReq DoRequest
|
||||
if err := json.Unmarshal([]byte(rawReq), &doReq); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ps.Impl.Do(context.Background(), doReq.CommandName, doReq.Args); err != nil {
|
||||
//var doReq DoRequest
|
||||
//if err := json.Unmarshal([]byte(rawReq), &doReq); err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
if err := ps.Impl.Do(context.Background(), args.CommandName, args.Args); err != nil {
|
||||
return err
|
||||
}
|
||||
*resp = ""
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user