ExpandMap expands JavaScript template literals in all values of the given map.
(ctx context.Context, kv map[string]string)
| 102 | |
| 103 | // ExpandMap expands JavaScript template literals in all values of the given map. |
| 104 | func (exp *Expander) ExpandMap(ctx context.Context, kv map[string]string) map[string]string { |
| 105 | if kv == nil { |
| 106 | return nil |
| 107 | } |
| 108 | |
| 109 | vm := exp.newVMWithBindings(ctx) |
| 110 | |
| 111 | expanded := make(map[string]string, len(kv)) |
| 112 | for k, v := range kv { |
| 113 | expanded[k] = runExpansion(vm, v) |
| 114 | } |
| 115 | return expanded |
| 116 | } |
| 117 | |
| 118 | // ExpandCommands expands JavaScript template literals in all command fields. |
| 119 | func (exp *Expander) ExpandCommands(ctx context.Context, cmds types.Commands) types.Commands { |