stash/pkg/plugin/args.go

27 lines
591 B
Go
Raw Normal View History

2020-08-08 02:05:35 +00:00
package plugin
type OperationInput map[string]interface{}
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
func applyDefaultArgs(args OperationInput, defaultArgs map[string]string) {
2020-08-08 02:05:35 +00:00
for k, v := range defaultArgs {
_, found := args[k]
if !found {
args[k] = v
2020-08-08 02:05:35 +00:00
}
}
}