From 90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 11 Nov 2024 01:12:29 +0800 Subject: HALF WORK: 2024.1.20 - 4 --- tools/cru-py/cru/service/_template.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/cru-py/cru/service') 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}.") -- cgit v1.2.3