aboutsummaryrefslogtreecommitdiff
path: root/tools/cru-py/cru/service/_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cru-py/cru/service/_template.py')
-rw-r--r--tools/cru-py/cru/service/_template.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/cru-py/cru/service/_template.py b/tools/cru-py/cru/service/_template.py
index ca2135f..b6affd1 100644
--- a/tools/cru-py/cru/service/_template.py
+++ b/tools/cru-py/cru/service/_template.py
@@ -1,4 +1,5 @@
from argparse import Namespace
+import shutil
from cru import CruIterator
from cru.template import TemplateTree
@@ -47,6 +48,8 @@ class TemplateManager(AppCommandFeatureProvider):
def _generate_files(self, dry_run: bool) -> None:
config_manager = self.app.get_feature(ConfigManager)
+ if not dry_run:
+ 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
)
@@ -78,3 +81,4 @@ 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}.")