Run executes tasks Deprecated: Run is deprecated, you should use DoTasks is builtin package, it will automatically register all internal functions
(spec map[string]interface{}, io util.IOStreams)
| 87 | // Run executes tasks |
| 88 | // Deprecated: Run is deprecated, you should use DoTasks is builtin package, it will automatically register all internal functions |
| 89 | func Run(spec map[string]interface{}, io util.IOStreams) (map[string]interface{}, error) { |
| 90 | var ( |
| 91 | ctx = newCallCtx(io, spec) |
| 92 | retSpec = map[string]interface{}{} |
| 93 | ) |
| 94 | |
| 95 | tasks := GetTasks() |
| 96 | |
| 97 | for key, params := range spec { |
| 98 | if do, ok := tasks[key]; ok { |
| 99 | if err := do(ctx, params); err != nil { |
| 100 | return nil, errors.WithMessagef(err, "do task %s", key) |
| 101 | } |
| 102 | } else { |
| 103 | retSpec[key] = params |
| 104 | } |
| 105 | } |
| 106 | return retSpec, nil |
| 107 | } |