project init (pi)
This is intended to provide something similar to cookiecutter, albeit faster. It is somewhat more limited that cookiecutter, but for most users the difference will be imperceptible (though it will be noticeably faster!).
Cool benchmarks (with Haskell's bench):
Tool | Language | Time (vim example plugin) |
---|---|---|
pi | Rust | 317.1 ms |
cookiecutter | Python | 10.10 ms |
Reasons to use pi:
- Templates are smaller. Define files you need in a
.toml
rather than an entire directory tree. - Fast. pi 30x faster than cookiecutter when rendering the sample vim plugin template.
- pi uses mustache, a logic-less language that has libraries for many other languages. That means that you can manipulate your pi templates in other languages.
- pi can initialize a git or mercurial repository inside your new project Reasons not to use pi:
- pi does not (currently) fetch templates remotely.
- pi uses logic-less templates, which are not as sophisticated as the jinja templates that cookiecutter uses.
- pi is a work in progress. This might mean you run into some bugs.
Use
For use examples, check out examples/vim-plugin
Configuration
Configuration is via the ~/.pi.toml
file. The following is an example:
[]
= ["syntax/{{ project }}.vim","plugin/{{ project }}.vim","doc/{{ project }}.txt"]
= ["doc","syntax","plugin"]
= ["LICENSE","README.md","vimball.txt"]
[]
= "0.1.0"
= "git"
Templates
pi
uses mustache for templating, via the
rustache crate.
You can find examples and help on the mustache page.