diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/cru-py/cru/service/_template.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/cru-py/cru/service/_template.py b/tools/cru-py/cru/service/_template.py index b6affd1..170116c 100644 --- a/tools/cru-py/cru/service/_template.py +++ b/tools/cru-py/cru/service/_template.py @@ -48,7 +48,7 @@ class TemplateManager(AppCommandFeatureProvider): def _generate_files(self, dry_run: bool) -> None: config_manager = self.app.get_feature(ConfigManager) - if not dry_run: + if not dry_run and self.generated_dir.full_path.exists(): shutil.rmtree(self.generated_dir.full_path) self.template_tree.generate_to( self.generated_dir.full_path_str, config_manager.get_str_dict(), dry_run @@ -81,4 +81,6 @@ class TemplateManager(AppCommandFeatureProvider): self._generate_files(dry_run) if dry_run: print("Dry run successfully.") - print(f"Will delete dir {self.generated_dir.full_path_str}.") + print( + f"Will delete dir {self.generated_dir.full_path_str} if it exists." + ) |