@@ -59,23 +59,25 @@ def post_gen_project() -> int:
5959 try :
6060 direnv_allow = sh .direnv .bake ("allow" )
6161 except sh .CommandNotFound :
62+ logger .optional ("direnv is not available, skipping direnv allow." )
6263 direnv_allow = lambda * args , ** kwargs : None
6364
64- try :
65- gh_repo_create = sh .gh .repo .create (
66- "{{ cookiecutter.package_name }}" ,
67- # {% if cookiecutter.make_github_repo_private %}
68- "--private" ,
69- # {% else %}
70- "--public" ,
71- # {% endif %}
72- "--push" ,
73- "--source=." ,
74- "--remote=upstream" ,
75- )
76- except sh .CommandNotFound :
77- gh_repo_create = lambda * args , ** kwargs , None
78-
65+ # {% if cookiecutter.create_github_repo is defined and cookiecutter.create_github_repo %}
66+ gh_repo_create = sh .gh .repo .create .bake (
67+ "{{ cookiecutter.package_name }}" ,
68+ # {% if cookiecutter.make_github_repo_private is defined and cookiecutter.make_github_repo_private %}
69+ "--private" ,
70+ # {% else %}
71+ "--public" ,
72+ # {% endif %}
73+ "--push" ,
74+ "--source=." ,
75+ "--remote=upstream" ,
76+ )
77+ # {% else %}
78+ gh_repo_create = lambda * args , ** kwargs : None
79+ # {% endif %}
80+
7981 cmds = [
8082 (True , sh .uv .python .install .bake ("{{ cookiecutter.python_version_dev }}" )),
8183 (False , direnv_allow ),
@@ -84,9 +86,7 @@ def post_gen_project() -> int:
8486 (True , sh .git .init .bake ("--quiet" , "--initial-branch" , "main" )),
8587 (True , sh .git .add .bake ("." )),
8688 (True , sh .git .commit .bake ("-m" , "initial commit" )),
87- # {% if cookiecutter.create_github_repo %}
88- (False , gh_repo_create )
89- # {% endif %}
89+ (False , gh_repo_create ),
9090 ]
9191
9292 for required , cmd in cmds :
0 commit comments