Code Monkey home page Code Monkey logo

tera-cli's Introduction

Tera CLI

CI Status Crates.io License: MIT

Tera CLI for one-off template interpolation from context file / env vars.

The following context formats are supported:

  • JSON context file (--json . defaults to .tera.json)
  • TOML context file (--toml . defaults to .tera.toml)
  • YAML context file (--yaml . defaults to .tera.yaml)
  • Environment variables

Changelog

See CHANGELOG.md.

Simple Examples

TOML

Template template.tmpl

{% if hello %}{{ msg }}{% endif %}

TOML .tera.toml

hello = true
msg = "Hello World!"

STDOUT

> tera -f template.tmpl --toml .
Hello World!

> cat template.tmpl | tera --toml .
Hello World!

> tera -s "$(cat template.tmpl)" --toml .
Hello World!

Environment Variables

Template template.tmpl

{% if MSG %}{{ MSG }}{% endif %}

STDOUT

> MSG="Hello World!" tera -f template.tmpl --env
Hello World!

By default, setting --toml . looks for .tera.toml context file in current working directory. Similarly, setting --json . looks for .tera.json in current working directory. Use --toml file_to_toml to change the path to the context file.

For more details, run

tera --help

Acknowledgement

Thanks to original Tera author, whose GitHub repository is at: https://github.com/Keats/tera.

Also thanks to BurntSushi and his ripgrep repository showcase of GitHub Actions for cross-compilation, which has been copied and adapted heavily into this repository. The original files are here: https://github.com/BurntSushi/ripgrep/tree/12.0.1/.github/workflows.

tera-cli's People

Contributors

guangie88 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.