with handling for do
This commit is contained in:
@@ -10,6 +10,29 @@ type PluginClient struct {
|
||||
client *rpc.Client
|
||||
}
|
||||
|
||||
type DoRequest struct {
|
||||
CommandName string `json:"commandName"`
|
||||
Args map[string]string `json:"args"`
|
||||
}
|
||||
|
||||
// Do implements Plugin
|
||||
func (pc *PluginClient) Do(ctx context.Context, commandName string, args map[string]string) error {
|
||||
req := &DoRequest{
|
||||
CommandName: commandName,
|
||||
Args: args,
|
||||
}
|
||||
doReq, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = pc.client.Call("Plugin.Do", doReq, new(any))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ Plugin = &PluginClient{}
|
||||
|
||||
func (pc *PluginClient) About(ctx context.Context) (*About, error) {
|
||||
|
Reference in New Issue
Block a user