tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine.

Related tags

Command-line tpp
Overview

TPP (Tera Pre-Processor)

crates.io License: MIT

tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine. Drawing inspiration from pre-processors like cpp and gpp, tpp is the next evolution with its powerful expressive toolset.

Learn more about Tera

Simple Example

Create a Dockerfile from a template:

Dockerfile.in

FROM {{ base_image }}

LABEL maintainer="{{ maintainer }}"

RUN apt-get update && apt-get install -y \
{{ packages | join(sep=' ') }}

COPY . /app
WORKDIR /app

ENV PORT {{ port }}
EXPOSE {{ port }}

CMD ["{{ entrypoint }}"]

context.json

{
  "base_image": "python:3.8-slim",
  "maintainer": "[email protected]",
  "packages": [
    "build-essential",
    "libpq-dev"
  ],
  "port": 8080,
  "entrypoint": "python app.py"
}

Command

tpp Dockerfile.in -c context.json -o Dockerfile

Dockerfile

FROM python:3.8-slim

LABEL maintainer="[email protected]"

RUN apt-get update && apt-get install -y \
    build-essential libpq-dev

COPY . /app
WORKDIR /app

ENV PORT 8080
EXPOSE 8080

CMD ["python app.py"]

Install

cargo install --git https://github.com/mcmah309/tpp

Usage

Usage: tpp [OPTIONS] 

Arguments:
    Path to the template file you wish to render

Options:
  -c, --context-file   Optional: Specify the path to context data in JSON, YAML, or TOML format
      --stdin                        Optional: Enable passing context data via standard input. Useful for merging different context files or processing context data with tools like `jq`
  -i, --include             Optional: Define directories (and their subdirectories) to search for additional templates referenced in ``. Necessary for templates that import or include other files. Note: any relative paths specified in the `import` or `include` statements within templates are resolved relative to the directories indicated by `--include`
      --env                          Optional: Use current environment variables as context data. This can be merged with data from `--context-file` or `--stdin`. Merging occurs after, unless `--env-first` is set. Useful for dynamic template data population
  -e, --env-key             Optional: Designate a specific key under which all environment variables will be nested in the context data. Requires `--env` to be set
      --env-first                    Optional: Apply environment variable context before any other context. Allows another context to override the env context. Requires `--env` to be set
      --fail-on-collision            Optional: Command will terminate if there's a conflict between environment variables and other context data. Requires `--env` to be set
  -o, --out                     Optional: Specify an output file to write the rendered template. If omitted, the output is directed to standard output (stdout)
      --escape                       Optional: Enable auto-escaping of rendered content, which is particularly useful for HTML
      --debug                        Optional: Enable debug mode to print detailed debug information to standard output (stdout)
  -h, --help                         Print help
  -V, --version                      Print version
You might also like...
Scouty is a command-line interface (CLI) to keep an eye on substrate-based chains and hook things up
Scouty is a command-line interface (CLI) to keep an eye on substrate-based chains and hook things up

scouty is a command-line interface (CLI) to keep an eye on substrate-based chains and hook things up

Gix is a command-line interface (CLI) to access git repositories

gix is a command-line interface (CLI) to access git repositories. It's written to optimize the user-experience, and perform as good or better than the

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project.

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project. With just a few primary configurations, such as project name, you can get started quickly.

KAIVM is a multiplatform Command Line Interface (CLI) designed to simplify the process of downloading, managing, configuring, and running different versions of Shinkai Node
KAIVM is a multiplatform Command Line Interface (CLI) designed to simplify the process of downloading, managing, configuring, and running different versions of Shinkai Node

KAIVM - Shinkai Version Manager KAIVM is a multiplatform Command Line Interface (CLI) designed to simplify the process of downloading, managing, confi

Anglosaxon is a command line tool to parse XML files using SAX
Anglosaxon is a command line tool to parse XML files using SAX

anglosaxon - Convert large XML files to other formats anglosaxon is a command line tool to parse XML files using SAX. You can do simple transformation

Librarian runs pre-configured commands against a group of files that match a set of filters

Filesystem Librarian Librarian runs pre-configured commands against a group of files that match a set of filters. The group of files is called a libra

Pre-commit hook to help me stop naming files *.yml half of the time

Disallow file endings Pre-commit hook that lets you specify banned file endings. I keep naming half my yaml files *.yaml and the other *.yml and it's

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust
A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust. This tool is intended for Witcher 3 modders who make mainly scri

This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure.

HeyGPT This is a simple command-line interface tool that allows you to interact with ChatGPT from OpenAI or Azure. You can use it to: Chat with ChatGP

Releases(v0.1.1)
Owner
null
Functional command-line JSON processor

rq rq is a tiny functional language with which you can manipulate JSON. Basically, it is (an insignificant subset of!) jq, written in Rust. NOTE: This

Tony Zorman 13 Feb 10, 2024
Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're working with files or directories, this tool simplifies common file operations with ease.

Rust FileOps Rust File Management CLI is a command-line tool written in Rust that provides essential file management functionalities. Whether you're w

Harikesh Ranjan Sinha 5 May 2, 2024
Discord-to-Cohost compiler written in Rust using Tera

Cohoard - Post formatted chatlogs to Cohost! Cohoard is a tool for turning chatlogs into formatted posts on Cohost. You can use Cohoard to easily form

Aaron Kofsky 14 Dec 15, 2022
Nodium is an easy-to-use data analysis and automation platform built using Rust, designed to be versatile and modular.

Nodium is an easy-to-use data analysis and automation platform built using Rust, designed to be versatile and modular. Nodium aims to provide a user-friendly visual node-based interface for various tasks.

roggen 19 May 2, 2023
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

Harry Nguyen 3 Feb 25, 2024
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
Dash is a CLI tool that rapidly sets up new projects by running a series of pre-defined commands.

Dash Dash is a CLI tool that rapidly sets up new projects by running a series of pre-defined commands. Features Quick Initialization: Initialize the c

Kunal Bagaria 4 Nov 7, 2023
Crunch is a command-line interface (CLI) to claim staking rewards every X hours for Substrate-based chains

crunch · crunch is a command-line interface (CLI) to claim staking rewards every X hours for Substrate-based chains. Why use crunch To automate payout

null 39 Dec 8, 2022
Railway CLI - This is the command line interface for Railway.

Railway CLI This is the command line interface for Railway. Use it to connect your code to Railways infrastructure without needing to worry about envi

Nebula 4 Mar 20, 2022