diff --git a/ingredients/file/file.go b/ingredients/file/file.go index 921b689..4c69190 100644 --- a/ingredients/file/file.go +++ b/ingredients/file/file.go @@ -443,6 +443,9 @@ func (f File) PropertiesForMethod(method string) (map[string]string, error) { "name": "string", }, nil case "symlink": + // return ingredients.MethodPropsSet{ + // ingredients.MethodProps{Key: "name", Val: "string", IsReq: true}, + // }.ToMap(), nil return map[string]string{ "name": "string", "target": "string", "force": "bool", "backupname": "string", "makedirs": "bool", "user": "string", "group": "string", "mode": "string", diff --git a/ingredients/ingredients.go b/ingredients/ingredients.go index a9d7d64..448a28d 100644 --- a/ingredients/ingredients.go +++ b/ingredients/ingredients.go @@ -17,6 +17,27 @@ func init() { ingMap = make(map[types.Ingredient]map[string]types.RecipeCooker) } +type MethodProps struct { + Key string + Val string + IsReq bool +} + +type MethodPropsSet []MethodProps + +func (m MethodPropsSet) ToMap() map[string]string { + ret := make(map[string]string) + for _, v := range m { + ret[v.Key] = v.Val + if v.IsReq { + ret[v.Key] = ret[v.Key] + ",req" + } else { + ret[v.Key] = ret[v.Key] + ",opt" + } + } + return ret +} + func RegisterAllMethods(step types.RecipeCooker) { ingTex.Lock() defer ingTex.Unlock()