2020-08-08 02:05:35 +00:00
|
|
|
package plugin
|
|
|
|
|
2024-02-22 00:20:21 +00:00
|
|
|
type OperationInput map[string]interface{}
|
|
|
|
|
2022-04-25 05:55:05 +00:00
|
|
|
type PluginArgInput struct {
|
|
|
|
Key string `json:"key"`
|
|
|
|
Value *PluginValueInput `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PluginValueInput struct {
|
|
|
|
Str *string `json:"str"`
|
|
|
|
I *int `json:"i"`
|
|
|
|
B *bool `json:"b"`
|
|
|
|
F *float64 `json:"f"`
|
|
|
|
O []*PluginArgInput `json:"o"`
|
|
|
|
A []*PluginValueInput `json:"a"`
|
|
|
|
}
|
2020-08-08 02:05:35 +00:00
|
|
|
|
2024-02-22 00:20:21 +00:00
|
|
|
func applyDefaultArgs(args OperationInput, defaultArgs map[string]string) {
|
2020-08-08 02:05:35 +00:00
|
|
|
for k, v := range defaultArgs {
|
2024-02-22 00:20:21 +00:00
|
|
|
_, found := args[k]
|
|
|
|
if !found {
|
|
|
|
args[k] = v
|
2020-08-08 02:05:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|