ReplaceDIRMacro replaces all `{DIR}` macros in params with cwd.
()
| 346 | |
| 347 | // ReplaceDIRMacro replaces all `{DIR}` macros in params with cwd. |
| 348 | func (t *TestCase) ReplaceDIRMacro() error { |
| 349 | cwd, err := os.Getwd() |
| 350 | if err != nil { |
| 351 | return err |
| 352 | } |
| 353 | |
| 354 | var params []string |
| 355 | for _, param := range t.params { |
| 356 | param = strings.ReplaceAll(param, "{DIR}", cwd) |
| 357 | |
| 358 | params = append(params, param) |
| 359 | } |
| 360 | |
| 361 | t.params = params |
| 362 | |
| 363 | return nil |
| 364 | } |
| 365 | |
| 366 | func setupTempDir(files files) (dir string, err error) { |
| 367 | tempDir, err := ioutil.TempDir("", "kpt-fn-export-test") |