Call a method on the plugin.
(method string, args ...string)
| 44 | |
| 45 | // Call a method on the plugin. |
| 46 | func (h *Host) Call(method string, args ...string) (string, error) { |
| 47 | opts := &CallOptions{ |
| 48 | AccessToken: viper.GetString(doctl.ArgAccessToken), |
| 49 | Args: args, |
| 50 | } |
| 51 | |
| 52 | var result string |
| 53 | err := h.client.Call(method, opts, &result) |
| 54 | if err != nil { |
| 55 | debug(err.Error()) |
| 56 | return "", fmt.Errorf("unable to run plugin action %s", method) |
| 57 | } |
| 58 | |
| 59 | return result, nil |
| 60 | } |
| 61 | |
| 62 | func debug(msg string) { |
| 63 | //if viper.GetBool("verbose") { |