mustsubst

Crates.iomustsubst
lib.rsmustsubst
version0.1.0
sourcesrc
created_at2019-07-17 10:59:41.212339
updated_at2019-07-17 10:59:41.212339
descriptionLike envsubst but with mustache!
homepage
repository
max_upload_size
id149635
size15,775
Daniel Mason (Gisleburt)

documentation

README

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
Commit count: 0

cargo fmt