templative
A tiny CLI for instantiating project templates from local directories. Templates are tracked by absolute path; there is no templating engine.
Git is initialized by default (with an initial commit) when you create a project from a template.
Commands
| Command | Description |
|---|---|
templative init TEMPLATE [PATH] |
Copy a template into PATH (default: current directory), then run git init and an initial commit. |
templative add [PATH] [--name NAME] |
Register an existing directory as a template (default PATH: current directory; default name: directory name). |
templative change TEMPLATE [FLAGS] |
Change and set custom features for individual templates. |
templative remove TEMPLATE... |
Remove one or more templates from the registry. Does not delete the actual files. |
templative update [TEMPLATE] [--check] |
Update cached git templates. Omit name to update all. --check reports what's out of date without applying changes. |
templative list |
Show registered templates and their paths. |
Optional flags are available to view with --help. This also applies to subcommands, e.g. templative change --help.
Install
Homebrew:
Cargo:
Or download a pre-built binary from the releases page.
Completions
zsh:
Then add these two lines to your ~/.zshrc before any existing compinit call (or at the end if you don't have one):
fpath=(/.zsh/completions )
&&
Then: source ~/.zshrc
bash:
fish:
PowerShell:
To check whether an installed script is up to date after upgrading templative:
Config
The config can be used to set values that apply across all templates, or which affect tool functionality. Values here can be overridden by settings in templates.json or with flags.
- Config location:
- Linux / macOS:
~/.config/templative/config.json - Windows:
%APPDATA%\templative\templative\config.json
- Linux / macOS:
A default config is created automatically if there isn't one. This is the default config created, with comments added:
Template Registry
The registry of available templates is the backbone of templative. You can customise individual templates with specific behaviours using templative change.
By default optional fields are not set. In this case they fallback to the config setting.
- Registry location:
- Linux / macOS:
~/.config/templative/templates.json - Windows:
%APPDATA%\templative\templative\templates.json
- Linux / macOS: