Skip to content

Commit f1237ff

Browse files
committed
rename project directory on init
1 parent 2902a8b commit f1237ff

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

scripts/init_project.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,18 @@ def test_add():
115115
author_email
116116
)
117117

118-
# Initialize new git repository
119-
print("🔄 Reinitializing git repository...")
120-
if os.path.exists(".git"):
121-
run_command("rm -rf .git")
122-
run_command("git init")
123-
run_command("git add .")
124-
run_command('git commit -m "feat: Initial project setup"')
118+
# Get current directory name and handle renaming
119+
current_dir = os.path.basename(os.getcwd())
120+
if current_dir == "python-collab-template" or current_dir == "python-project-test":
121+
parent_dir = os.path.dirname(os.getcwd())
122+
new_dir = os.path.join(parent_dir, project_name)
123+
print(f"📁 Renaming project directory to {project_name}...")
124+
if os.path.exists(new_dir):
125+
print(f"⚠️ Directory {project_name} already exists. Keeping current directory name.")
126+
else:
127+
os.chdir(parent_dir)
128+
os.rename(current_dir, project_name)
129+
os.chdir(project_name)
125130

126131
# Install dependencies and set up environment
127132
print("🔨 Setting up development environment...")
@@ -139,7 +144,7 @@ def test_add():
139144
)
140145

141146
# Initialize new git repository
142-
print("🔄 Reinitializing git repository...")
147+
print("🔄 Initializing git repository...")
143148
if os.path.exists(".git"):
144149
run_command("rm -rf .git")
145150
run_command("git init")

0 commit comments

Comments
 (0)