| 436 | } |
| 437 | |
| 438 | func checkOutputDirectoryIsEmpty(cli *cli, cmd *cobra.Command, outputDIR string) bool { |
| 439 | _, err := os.Stat(outputDIR) |
| 440 | if os.IsNotExist(err) { |
| 441 | return true |
| 442 | } |
| 443 | |
| 444 | _, mainFileErr := os.Stat(path.Join(outputDIR, "auth0_main.tf")) |
| 445 | _, importFileErr := os.Stat(path.Join(outputDIR, "auth0_import.tf")) |
| 446 | _, generatedFileErr := os.Stat(path.Join(outputDIR, "auth0_generated.tf")) |
| 447 | if os.IsNotExist(mainFileErr) && os.IsNotExist(importFileErr) && os.IsNotExist(generatedFileErr) { |
| 448 | return true |
| 449 | } |
| 450 | |
| 451 | cli.renderer.Warnf( |
| 452 | "Output directory %q is not empty. "+ |
| 453 | "Proceeding will overwrite the auth0_main.tf, auth0_import.tf and auth0_generated.tf files.", |
| 454 | outputDIR, |
| 455 | ) |
| 456 | |
| 457 | if !cli.force && canPrompt(cmd) { |
| 458 | if confirmed := prompt.Confirm("Are you sure you want to proceed?"); !confirmed { |
| 459 | return false |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | return true |
| 464 | } |
| 465 | |
| 466 | func cleanOutputDirectory(outputDIR string) error { |
| 467 | var joinedErrors error |