Complete command-line reference for render.
render <template-source> <data-source> -o <output> [OPTIONS]
Path to a template file or directory.
- File: Single template file (e.g.,
config.tmpl) - Directory: Directory containing templates (e.g.,
./templates)
Files with .tmpl extension are processed as Go templates. Other files in directories are copied verbatim.
Path to a JSON or YAML data file.
- JSON:
data.json,config.json - YAML:
data.yaml,data.yml,config.yaml
The file format is detected by extension.
Output path. Required.
-o output.txt # Single file
-o ./output # Directory
-o ./output/ # Directory (explicit with trailing slash)
-o '{{.name}}.txt' # Dynamic path (each mode)Overwrite existing files without prompting.
render config.tmpl data.json -o config.yaml --forceDefault: false (refuse to overwrite existing files)
Transform data using a jq expression before rendering.
render tmpl data.json --query '.config.database' -o out.txt
render tmpl data.json --query '.users | map(select(.active))' -o out.txtThe transformed data becomes the root object available to templates.
Extract items from data for iteration. Enables each mode.
render user.tmpl data.json --item-query '.users[]' -o '{{.name}}.txt'
render user.tmpl data.json --item-query '.users[] | select(.active)' -o '{{.name}}.txt'Each extracted item becomes the root data for one template render.
Explicit path to a control file for path mappings.
render ./templates data.json -o ./output --control ./custom.yamlDisables auto-discovery of .render.yaml, .render.yml, and render.json.
Show what files would be written without writing them.
render ./templates data.json -o ./output --dry-runOutput shows planned file operations.
Output results in machine-readable JSON format.
render ./templates data.json -o ./output --jsonEach line is a JSON object:
{"path":"output/config.yaml","action":"write"}
{"path":"output/logo.png","action":"copy"}Generate man pages.
render gen man <output-dir>Example:
render gen man ./man
man ./man/render.1Generate markdown documentation.
render gen markdown <output-dir>Example:
render gen markdown ./docs/cliGenerate shell completion scripts.
render completion bash
render completion zsh
render completion fish
render completion powershell| Code | Name | Description |
|---|---|---|
| 0 | Success | All files rendered successfully |
| 1 | RuntimeError | Error during template rendering |
| 2 | UsageError | Invalid command-line arguments |
| 3 | InputValidation | Missing files or malformed data |
| 4 | PermissionDenied | Filesystem permission error |
| 5 | OutputConflict | File exists and --force not specified |
| 6 | SafetyViolation | Path traversal or symlink attack detected |
render does not use environment variables directly, but templates can access them via shell expansion in data files:
# In shell
export DB_HOST=localhost
envsubst < data.template.json > data.json
render config.tmpl data.json -o config.yamlrender config.tmpl values.json -o config.yamlrender ./templates data.yaml -o ./outputrender user.tmpl users.json --item-query '.users[]' -o '{{.username}}.txt'render template.tmpl config.json --query '.database' -o db-config.txtrender ./templates data.json -o ./dist --dry-runrender config.tmpl values.json -o config.yaml --forcerender ./templates data.json -o ./dist --jsonrender user.tmpl data.json \
--query '.response.data' \
--item-query '.users[] | select(.verified)' \
-o 'users/{{.id}}.txt'render ./templates data.json -o ./output --control ./mappings.yaml