Favorite templates can be defined in a config file, that by default is placed at
To specify an alternate configuration file, use the
--config <config-file> option.
⚠️ NOTE: A relative
--configoption, will be relative to the template root during expansion.
Each favorite template is specified in its own section, e.g.:
[favorites.demo] description = "<optional description, visible with --list-favorites>" git = "https://github.com/rustwasm/wasm-pack-template" branch = "<optional-branch>" subfolder = "<optional-subfolder>" vcs = "<optional: None|Git>" init = optional true|false overwrite = optional true|false
Values may be overridden using the CLI arguments of the same names (e.g.
--subfolder for the
init = true has the effect of forcing the template to exhibit behaviour as if
--init is specified on the
commandline, as there is no counter-option!
overwrite = true has the effect of allowing the template to always overwrite files as there is no counter-option!
When favorites are available, they can be generated simply by invoking:
cargo gen <favorite>
or slightly more involved:
cargo generate demo --branch mybranch --name expanded_demo --subfolder myfolder
⚠️ NOTE: when
<favorite>is not defined in the config file, it is interpreted as a git repo like as if