Skip to content

Commit

Permalink
feat(cxx): git init at post_gen_project
Browse files Browse the repository at this point in the history
  • Loading branch information
pplmx committed Aug 29, 2024
1 parent 9f95dae commit d41eb07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions template/cxx/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess

cxx_build_tool = "{{cookiecutter.cxx_build_tool}}"

Expand All @@ -13,3 +14,11 @@
os.remove(cmake_file)
else:
raise ValueError(f"Unknown cxx_build_tool: {cxx_build_tool}")

# Initialize Git repository
try:
subprocess.run(["git", "init"], check=True)
except subprocess.CalledProcessError:
print("Failed to initialize Git repository. Please make sure Git is installed and try manually.")
except FileNotFoundError:
print("Git command not found. Please install Git and try again.")

0 comments on commit d41eb07

Please sign in to comment.