Germinate

Crates.io docs.rs GitHub Workflow Status (branch) Crates.io

A templating library for injecting variables from multiple external sources

Library

Example

This is a simple example showing how to pull values from the environment

```rust use germinate::Seed;

[tokio::main]

async fn main() { std::env::set_var("NAME", "John Wick"); let mut seed = Seed::new("Hi %env:NAME%!".into()); let output = seed.germinate().await.unwrap();

assert_eq!(String::from("Hi John Wick!"), output);

} ```

Binary

Germinate provides a CLI for templating files, available from the Github releases. To run the CLI, cimply download the binary for your system and check the usage with germinate --help

Example

The CLI can be used to parse an template file and output it either to stdout or optionally, an output file

```

To print the parsed result to stdout

germinate myfile.txt.tmpl

To write the output to a file

germinate myfile.txt.tmpl -o myfile.txt ```

Sources

Currently implemented sources:

Custom sources

For an example of integrating your own value source, checkout the Seed struct in the docs

License

GPL-3.0