crispr
is a CLI tool allowing to scaffold a project from a template with a .crispr.{toml,json}
configuration file.
The template uses tokens that need to be replaced per scaffolded project (e.g. {{REPO_NAME}}
), which are set in the configuration file as either user replaceable or with predetermined values.
crispr
reads the configuration, asks the user for any needed values and makes the replacements as needed, showing a diff in the process.
crispr
respects .gitignore
files and only changes files that should be committed.
The .crispr.{toml,json}
configuration file itself is automatically ignored when replacing tokens.
Named after the CRISPR-cas9 genetic engineering technique used for targeted gene editing
crispr
is currently built for and tested on the following platforms:
x86_64-apple-darwin
(Intel macOS)
brew install yoav-lavi/tap/crispr
Binaries can be downloaded from the releases page
crispr [FLAGS] [PATH]
<PATH>
The path to runcrispr
('.'
by default)
-
-c, --config
The path to an alternative configuration file ('.crispr.{toml,json}'
by default) -
-d, --dry
Dry run - prints output without making changes -
-h, --help
Prints help information -
-V, --version
Prints version information
crispr
uses a TOML or JSON configuration file detailing the tokens to be replaced.
In case both file types are found, the priority is as follows:
.crispr.toml
.crispr.json
replacements
- a map (Option<HashMap<String, String>>
) of replacement tokens to valuesuser_replacements
- an array (Option<Vec<String>>
) of replacements for which the user will be asked to supply a value
.crispr.toml
user_replacements = [
"{{REPO_NAME}}"
]
[replacements]
"{{YEAR}}" = "2021"
.crispr.json
{
"replacements": {
"{{YEAR}}": "2021"
},
"userReplacements": ["{{REPO_NAME}}"]
}
crispr
reads files line-by-line, so a token broken into multiple lines (e.g. by formatting) will not be replaced
crispr
takes some inspiration and ideas from Ruplacer but does not intend to replace (pun may be intended) Ruplacer as the use case and goal are different.
crispr
uses the following dependencies:
clap
(Apache 2.0)difference
(MIT)colored
(MPL)ignore
(MIT)serde
(Apache 2.0)serde_json
(Apache 2.0)toml
(MIT)