Crates.io | mustsubst |
lib.rs | mustsubst |
version | 0.1.0 |
source | src |
created_at | 2019-07-17 10:59:41.212339 |
updated_at | 2019-07-17 10:59:41.212339 |
description | Like envsubst but with mustache! |
homepage | |
repository | |
max_upload_size | |
id | 149635 |
size | 15,775 |
The mustache substitution command line utility (like envsubst but for mustache templates).
$ cargo install -f mustsubst
Say we want to populate a simple template file, with a single variable called name
(you can
find this exact file in tests/1.hello.mustache
.
Hello {{name}}!
We can read the template and replace name with the following command:
$ mustsubst --arg name=World --file tests/1.hello.mustache
Hello World!
We can also read templates from stdin by specifying the file -
.
$ echo Hello {{name}}! | mustsubst --arg name=World --file -
Hello World!
This is particularly useful if we want to parse multiple files at once. For example:
$ cat tests/*.mustache | mustsubst --arg name=mustsubst --file -
Hello mustsubst!
mustsubst is awesome!
That's all the features we support right now!
At any time you can use --help to display help:
$ mustsubst --help
mustsubst 0.1.0
Daniel Mason <daniel@danielmason.com>
USAGE:
mustsubst [OPTIONS] --file <file>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--arg <arg>... A key value pair for the template in the form "key=value"
-f, --file <file> The location of a mustache template file, or "-" to use stdin