Open SHEscher opened 1 year ago
As of now, cookiecutter wont allow hook names that deviate from "post_gen_project" or "pre_gen_project" or "pre_prompt".
Created new PR to allow for multiple scripts, as long as they contain substring(s) mentioned above. i.e. "pre_gen_project_2" is valid. Also added sorting as requested :)
Hi,
first of all, thanks for the great tool!
I have a use-case, in which I run two
post_gen_project.*
hooks. One is a python script, the other is a bash script.I would like to determine the order in which they run. I noticed that the order changes currently, depending on the OS in use (I tested Mac and Linux).
Ordering could be archived by, e.g., naming the hooks
post_gen_project_0.py
&post_gen_project_1.sh
, such that a simplesorted()
would return them in order, see your code:https://github.com/cookiecutter/cookiecutter/blob/1b8520e7075175db4a3deae85e71081730ca7ad1/cookiecutter/hooks.py#L130C19-L130C26
This would require an additional small change in
valid_hook()
.Is this something you would consider for the package?
Best