Crates.io | tpp |
lib.rs | tpp |
version | 0.1.1 |
source | src |
created_at | 2023-11-20 04:49:34.727055 |
updated_at | 2023-11-20 07:39:39.755567 |
description | tpp (Tera Pre-Processor) is a command line utility for preprocessing files with the tera templating engine |
homepage | |
repository | https://github.com/mcmah309/tpp |
max_upload_size | |
id | 1041716 |
size | 536,349 |
tpp
(Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the
Tera templating engine. Drawing inspiration from renowned pre-processors like cpp
and gpp, tpp
stands out with its user-friendly command-line interface that
efficiently renders templates for diverse applications.
Learn more about Tera
Create a Dockerfile
from a template:
FROM {{ base_image }}
LABEL maintainer="{{ maintainer }}"
RUN apt-get update && apt-get install -y \
{{ packages | join(' ') }}
COPY . /app
WORKDIR /app
ENV PORT {{ port }}
EXPOSE {{ port }}
CMD ["{{ entrypoint }}"]
{
"base_image": "python:3.8-slim",
"maintainer": "dev@example.com",
"packages": [
"build-essential",
"libpq-dev"
],
"port": 8080,
"entrypoint": "python app.py"
}
tpp Dockerfile.in -c context.json -o Dockerfile
FROM python:3.8-slim
LABEL maintainer="dev@example.com"
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"]
Usage: tpp [OPTIONS] <TEMPLATE_FILE>
Arguments:
<TEMPLATE_FILE> Path to the template file you wish to render
Options:
-c, --context-file <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 <INCLUDE> Optional: Define directories (and their subdirectories) to search for additional templates referenced in `<TEMPLATE_FILE>`. 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 <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 <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