From 28b5c6a9d3e256671482181633b123a243605bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bartmi=C5=84ski?= Date: Sun, 8 Dec 2024 23:55:34 +0100 Subject: [PATCH] Leave old 'abc' template string for now --- src/sinol_make/commands/init/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sinol_make/commands/init/__init__.py b/src/sinol_make/commands/init/__init__.py index fe79a5b8..d9556609 100644 --- a/src/sinol_make/commands/init/__init__.py +++ b/src/sinol_make/commands/init/__init__.py @@ -70,6 +70,9 @@ def move_folder(self): raise for file in files: dest_filename = file + # TODO: remove the old 'abc' template + if file[:3] == 'abc': + dest_filename = self.task_id + file[3:] if file[:len(self.TEMPLATE_ID)] == self.TEMPLATE_ID: dest_filename = self.task_id + file[len(self.TEMPLATE_ID):] shutil.move(os.path.join(root, file), os.path.join(mapping[root], dest_filename)) @@ -84,6 +87,8 @@ def update_task_id(self): except UnicodeDecodeError: # ignore non-text files continue + # TODO: remove the old "abc" template + file_data = file_data.replace('abc', self.task_id) file_data = file_data.replace(self.TEMPLATE_ID, self.task_id) with open(path, 'w') as file: @@ -104,7 +109,7 @@ def run(self, args: argparse.Namespace): f"or use the --force flag to overwrite.") with tempfile.TemporaryDirectory() as tmpdir: try: - self.template_dir = self.download_template(tmpdir.name, args.template, args.verbose) + self.template_dir = self.download_template(tmpdir, args.template, args.verbose) os.chdir(destination)