8 unstable releases (3 breaking)

0.4.1 Sep 19, 2024
0.4.0 Sep 1, 2024
0.3.2 Aug 16, 2024
0.3.1 Jul 12, 2024
0.1.0 May 13, 2024

#32 in Template engine

Download history 2/week @ 2024-07-24 10/week @ 2024-07-31 204/week @ 2024-08-14 3/week @ 2024-08-21 138/week @ 2024-08-28 22/week @ 2024-09-04 40/week @ 2024-09-11 128/week @ 2024-09-18 35/week @ 2024-09-25 22/week @ 2024-10-02

665 downloads per month

MPL-2.0 license

73KB
1.5K SLoC

Ribboncurls CLI

Ribboncurls logo

Matrix Chat Crates.io Tests

Ribboncurls CLI is a tool for rendering mustache templates.

Table of Contents

Installation

Cargo

cargo install ribboncurls-cli

Homebrew

brew tap tinted-theming/tinted
brew install ribboncurls

Binaries

Download the relevant binary from the repository releases page.

Usage

Generate a Mustache file with a YAML data file

The following takes in ./path/to/page.html.mustache template file and generates ./page.html using ./path/to/data.yaml:

ribboncurls render ./path/to/page.html.mustache \
  --data-file="./path/to/data.yaml" \
  --out="./page.html"

Use stdin and stdout

echo "Hello, {{name}}!" | ribboncurls render - --data="name: World" > ./hello-world-example.txt

Commands

The following is a table of the available subcommands for the CLI tool, including the descriptions and any notable arguments.

Subcommand Description Arguments Example Usage
render Renders the Mustache template with provided data. mustache_file_path: Path to mustache file or - to accept stdin. ribboncurls render ./path/to/file.mustache or `echo "Hello, {{name}}!"

Flags

Flag/Option Description Required Repeat flag Applicable Subcommands Example Usage
--data -d A string of YAML data to be used when rendering. --data and/or --data-file Repeat render ribboncurls render /path/to/file.mustache --data="name: some_first_name"
--data-file -f Path to your YAML data file. --data and/or --data-file Repeat render ribboncurls render /path/to/file.mustache --data-file="/path/to/custom/data-file.yaml"
--partials -p A path to a file that contains YAML partial data. Optional Repeat render ribboncurls path/to/file.mustache --partials="path/to/partials-file.yaml" --partials="path/to/some/other/file.yaml"
--partial-file -f YAML data containing a "partial" property name and "partial" value (path to file to use as partial). Optional Repeat render ribboncurls render path/to/file.mustache --partial-file="property_name: path/to/file.mustache"
--out -o Writes stdout to a file. Optional No repeat render ribboncurls render /path/to/file.mustache" --out="./output.html"
--help -h Displays help information for the subcommand. Optional No repeat All ribboncurls --help, ribboncurls render --help, etc
--version -V Displays the current ribboncurls-cli version. Optional No repeat All ribboncurls --version

Repeat flag

Some flags may be repeated, for example:

ribboncurls render ./file.mustache \
  --data="name: Gillian" \
  --data="surname: Doe" \
  --data-file="./path/to/datafile1.yaml" \
  --data-file="./path/to/datafile2.yaml"

Contributing

Contributions are welcome! Have a look at CONTRIBUTING.md for more information.

License

Ribboncurls is licensed under the MPL-2.0 license.

Third-Party Licenses

This project includes third-party code licensed under the MPL-2.0 license. See the THIRD_PARTY_LICENSES file for details.

Dependencies

~5–7MB
~133K SLoC