We have a number of use cases where we'd like to be able to call cookiecutter and have the files and directories generated get put into the current working directory.
Simple example
What is essentially desired.
$ cd path/to/repo
$ ls
a.txt
$ cookiecutter path/to/template
$ls
a.txt b.txt
What the result actually is
$ cd path/to/repo
$ ls
a.txt
$ cookiecutter path/to/template
$ls
a.txt
template/
b.txt
Things I've tried
- You could imagine the template being something like this.
template/
cookiecutter.json
b.txt
But cookiecutter appears to require there to be a template root by default to avoid cookiecutter.exceptions.NonTemplatedInputDirException
.
- So, add a directory to contain the template files and try and output it to a particular directory.
template/
cookiecutter.json
{{cookiecutter.name}}
But then the template files are just nested in a subdirectory of the current working directory like shown above of course.
- I also expect one could use a post-generate hook to move the template's output files to where you want, but that seems like a bit of a hack...
I keep seeing comments on GitHub saying basically "this is solved", but I can't seem to find documentation on how to use whatever feature was added to accommodate this use case.