guidon-cli
is the tool using the guidon
library to render project templates.
It's executable is named guic
(as in guidon-cli...).
```bash $ guic --help
Apply template to project structure
USAGE:
guic [FLAGS] [OPTIONS]
FLAGS:
-a --auto_proxy [git] If set to true
, git tries to detect proxy configuration
-d --no-template-dir
Search templated files in the given folder
-g Git source : use this flag if the template is hosted in a git repo
-h, --help Prints help information
-i Interactive variables review before rendering template.
-k, --unsecure [git] If set to true
, certificate validity is not checked
-V, --version Prints version information
-v Verbose mode (-v: logs, -vv: more logs, -vvv: logs... and logs...)
OPTIONS:
-m, --mode lax
, missing values are defaulted to an empty string, if strict
an
error is raised for a missing value, if strict_ask
, user is prompted for missing
values [default: strict].
-r, --rev 1.0
), a branch
(origin/my_branch
) or a revision id. By default the value is set to master
ARGS:
bash
$ guic /path/to/template /path/to/target
If a git url is used, the ssh key must be present in ssh-agent instance. ```bash
$ guic -g https://url.to.my/git/repo /path/to/target
$guic -g git@git.provider:git/repo /path/to/target ```
With self-signed certificate and access token.
bash
$ guic -g -k https://:access_tooken@url.to.my/git/repo /path/to/target
With user password. You should provide url encoded user and password
bash
$guic -g https://user:password@url.to.my/git/repo /path/to/target
A basic template structure is the following :
a_folder/ parent folder
|- template.toml configuration file (key / values)
|- template/ folder containing templates files
| - file1.txt.hbs a template file (hbs extension)
| - file{{key1}} the {{key1}} part will be replaced
| - dir1
| |- file2.txt.hbs a template file
| |- file3.txt this file will be copied to destination
| - {{dirkey}} this folder will be renamed
| |- {{filekey}}.hbs this file will be renamed and rendered
And a file1.txt.hbs
file like:
This is a {{key2}}, but it could have been a {{key3}}.
With a template.toml
file like the following :
toml
[variables]
key1 = ".bak"
key2 = "plop"
key3 = "toto"
dirkey = "THE/FOLDER"
filekey = "my_file.ini"
The output structure will be:
target_folder/
|- file1.txt
|- file.bak
|- dir1/
| |- file2.txt
| |- file3.txt
|- THE/
|- FOLDER/
|- my_file.ini
and the file1.txt
content will be:
This is a plop, but it could have been a toto.
Some helpers are provided, see the readme
bash
$ cargo install --force guidon-cli
Prebuilt binaries are available there