# tpl
`tpl` is an extremely simple general-purpose templating tool written in
POSIX.1-2024-compliant AWK.
Usage:
tpl [vars file] [template file ...]
First define a list of variables in a file:
# This is a comment.
food = pizza
beverage = coffee
# Previously defined variables can be used in variable definitions.
# Whitespace is optional inside braces.
dinner = {{ food }} and {{beverage}}
# The = character can be surrounded by any number of whitespace
# characters.
one = 1
two = 2
three=3
Then reference those variables in your template files by enclosing them in
double braces:
My favorite food is {{ food }}, and my favorite beverage is
{{ beverage }}. I'm going to have {{ dinner }} for dinner tonight.
The first positive integers are {{one}}, {{two}}, and {{three}}.
{{one}} is the smallest of the three.
Then pass your variable file and template files, in that order, as arguments to
the `template` script. To see the examples above in action, run the following
command:
./tpl example/vars example/text.tpl
The result will be written to `stdout`.
You can also read from `stdin` by passing `-` in the file list:
echo "foo {{ bar }}" | ./tpl vars -