Skip to content

Commit 6d0b1b7

Browse files
committed
Allow selection of alt files in init script
1 parent 9a7e6f0 commit 6d0b1b7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

init_template.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
PLACEHOLDER_DIR = [Path("src/module_name/sample_data")]
1818
PYPROJECT_TARGET = Path("pyproject.toml")
1919
README_TARGET = Path("README.md")
20+
ALT_FILE_DIR = Path("alt_files")
2021
ORG = "Preocts"
2122
REPO = r"python\-src\-template"
2223

@@ -69,6 +70,19 @@ def get_input(prompt: str) -> str:
6970
return input(prompt)
7071

7172

73+
def select_project_type() -> None:
74+
"""Select whether alt_files should be used."""
75+
user_input = get_input("Switch to dependencies in pyproject.toml? (y/N) : ")
76+
if user_input.lower() == "y":
77+
for file in ALT_FILE_DIR.iterdir():
78+
file.replace(file.name)
79+
80+
# Remove alt_files directory and all contents
81+
for file in ALT_FILE_DIR.iterdir():
82+
os.remove(file)
83+
os.rmdir(ALT_FILE_DIR)
84+
85+
7286
def get_project_data() -> ProjectData:
7387
"""Query user for details on the project. This is the quiz."""
7488
data = ProjectData()
@@ -118,6 +132,8 @@ def rename_module_folder(name: str) -> None:
118132
if __name__ == "__main__":
119133
print("Eggcellent template setup:\n")
120134

135+
select_project_type()
136+
121137
project_data = get_project_data()
122138

123139
replace_pyproject_values(project_data)

0 commit comments

Comments
 (0)