Hey this seems really interesting, but I kinda don’t see where we are going to adopt/ host this.
Maybe a specific branch of exemplar? Will cargo generate work with a branch?
Also, is there any equivalent tooling in pip’s eco system? We already need pip to install pre-commit, I feel we should evaluate that before we pull another package manager into our tooling.
@Sdowney’s cookie-cutter branch does much the same thing. This was just a low-effort experiment using a different technology.
I haven’t though through about where it would be hosted. cargo-generate does work with branches and/or tags.
I’m aware of cookie cutter (see this). My understanding, which could be wrong, is that cookie cutter is a text templating engine that you’d use as a library whereas cargo-generate is a top-level application that instantiates a repo template.
What is particularly interesting about Zach’s approach is that it becomes straightforward to update as the exemplar is improved, whereas with cookie cutter, and presumably any template system, you need a tool like cruft to do updates, which inevitably fails with enough divergence.
Good project infrastructure seems to be independent of the project itself, but connected just enough that it is difficult to put elsewhere. At least that’s been what I’ve seen. It’s also something that C++ projects are notoriously bad at, since we have no common infrastructure and aversion to dependency. At least if it doesn’t come bundled with the IDE.
The cookie cutter I put together used Zach’s script where I said the name of the project was {{cookiecutter.project_name}} and then fixed up syntax errors and upcasing. I’m seriously considering borrowing the script for my own projects, though.
I wonder if a two-tool approach would work best: one for creating an initial project template, and another which acts like a “tidy” that flags nonconformance issues and sometimes suggests fixes.
One thing I’d love in a tidy script would be an error that’s flagged when a header file is included in the include subdirectory, but is not mentioned in a CMakeLists.txt.