1 unstable release
0.1.0 | Jul 17, 2019 |
---|
#18 in #mustache
7KB
mustsubst
The mustache substitution command line utility (like envsubst but for mustache templates).
Install
$ cargo install -f mustsubst
Usage
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
Dependencies
~4MB
~71K SLoC