Skip to content

Commit

Permalink
Leave old 'abc' template string for now
Browse files Browse the repository at this point in the history
  • Loading branch information
j4b6ski committed Dec 8, 2024
1 parent 8af3a17 commit 28b5c6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/sinol_make/commands/init/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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:
Expand All @@ -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)

Expand Down

0 comments on commit 28b5c6a

Please sign in to comment.