Skip to content

Commit

Permalink
refactor(template): simplify folder remove in post_gen_project.py b…
Browse files Browse the repository at this point in the history
…y using `shutil.rmtree`
  • Loading branch information
vicmattos committed Nov 21, 2023
1 parent 9632460 commit 5e2ab6e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions cookiecutter/tap-template/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
#!/usr/bin/env python
from pathlib import Path
import shutil


BASE_PATH = Path('{{cookiecutter.library_name}}')


def delete_folder(pth: Path):
for sub in pth.iterdir():
if sub.is_dir():
delete_folder(sub)
else:
sub.unlink()
pth.rmdir()


if __name__ == '__main__':

# Rename stream type client and delete others
Expand All @@ -31,5 +23,5 @@ def delete_folder(pth: Path):
Path('LICENSE').unlink()

if '{{ cookiecutter.include_ci_files }}' != 'GitHub':
delete_folder(Path('.github'))
shutil.rmtree(Path('.github'))

0 comments on commit 5e2ab6e

Please # to comment.