This is a command-line utility written in rust that initializes projects based on templates. It is intended to provide something similar to cookiecutter, but faster.
Reasons to use pi: - You want to automate the process of starting a new project, in a language-agnostic way. - You want project initialization that's quick
Reasons to use pi over cookiecutter:
- 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 to not use pi over cookiecutter: - 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 end up missing a feature.
Cool benchmarks (with Haskell's bench):
| Tool | Language | Time (vim example plugin) | Time (rust library) | | ---- | -------- | ------------------------- | ------------------- | | pi | Rust | 10.10 ms | 8.809 ms | cookiecutter | Python | 317.1 ms | 316.9 ms |
You can find binaries on the release page. Unfortunately, I can only create binaries for x64 linux, ARM linux, and 64-bit Windows at this time.
First, install cargo. Then type:
bash
$ cargo install project_init
and cargo will install pi for you.
For use examples, check out examples/vim-plugin
.
Bash commands:
bash
pi init path/to/template/dir/ new-project
Configuration is via the ~/.pi.toml
file. The following is an example:
```toml [files] files = ["syntax/{{ project }}.vim","plugin/{{ project }}.vim","doc/{{ project }}.txt"] directories = ["doc","syntax","plugin"] templates = ["LICENSE","README.md","vimball.txt"]
[config] version = "0.1.0" version_control = "git" ```
You can also set your defaults (e.g. name, email) in ~/.pi.toml
. The following is an example:
```bash version_control = "git"
[author] name = "Vanessa McHale" email = "vamchale@gmail.com" github_username = "vmchale" ```
This says your preferred version control is git
, and sets your name & email.
pi
uses mustache for templating, via the
rustache crate.
You can find examples and help on the mustache page.