Releases: jeremybower/tmpl
v2.0.2
v2.0.1
What's Changed
- Fix typo in readme by @jeremybower in #2
- Bump github.com/urfave/cli/v2 from 2.27.2 to 2.27.3 by @dependabot in #3
- Bump github.com/urfave/cli/v2 from 2.27.3 to 2.27.4 by @dependabot in #4
- Build docker image by @jeremybower in #5
- Login to the container registry by @jeremybower in #6
- Update readme with docker install instructions by @jeremybower in #7
- Add package write permissions to push to GHCR by @jeremybower in #8
- Fix version number by @jeremybower in #9
- Fix docker image version by @jeremybower in #10
- Remove major-only image tag by @jeremybower in #11
New Contributors
- @dependabot made their first contribution in #3
Full Changelog: v2.0.0...v2.0.1
v2.0.0
Overview
File Mounts
The v2 version changes the way template files (and other files) are consumed by tmpl. In the previous major version, only templates were given to tmpl as arguments, which had the significant limitation that only templates could be referenced by other templates.
In v2, there are flags to mount files and directories to specific paths for tmpl to access. For example, now tmpl can use the presence of other files to change the generated text (even if those files aren't included in the generated text) without passing them as templates.
- Continue to use
include
to dynamically include templates, but the first parameter is now the mounted path to the file. - Use the new
files
anddirs
built-in functions to list mounted files and directories that match the given glob pattern. - Use the new
filename
built-in function to get the mounted filename of the currently executing template.
File mounts also enable including files by relative paths. Previously, a template could only include another templates by using an absolute path.
Include Text Files
In addition to dynamically including other templates, v2 can dynamically include other text files without treating them as templates through the includeText
built-in function. This means that large blocks of text can be separated from the template itself for easier maintainability.
Missing Keys
The default behaviour of Go templates is to quietly replace missing keys with "". Version 2 changes that behaviour to return an error when a missing key is referenced. Failing loudly is usually preferable, but there might be reasons to instead render "" or the zero value. The default behaviour can be changed by using the --missingkey
flag. Since it is made redundant by this feature, the require
function has been removed in v2.
What's Changed
- Mount files by @jeremybower in #1
Full Changelog: v1.1.0...v2.0.0
v1.1.0
- Adds license to CLI
v1.0.0
v1.0.0