render

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: MIT

README

render

A CLI tool that uses Go text templates to generate output files from JSON or YAML data sources.

Installation

go install github.com/wernerstrydom/render/cmd/render@latest

Quick Start

# Render a single template
render config.tmpl values.json -o config.yaml

# Render a directory of templates
render ./templates data.yaml -o ./output

# Generate one file per item
render user.tmpl users.json --item-query '.users[]' -o '{{.username}}.txt'

# Preview without writing
render ./templates data.json -o ./dist --dry-run

Usage

render <template-source> <data-source> -o <output> [OPTIONS]
Arguments
  • template-source - Path to template file or directory
  • data-source - Path to JSON or YAML data file
Options
Flag Description
-o, --output Output path (required)
-f, --force Overwrite existing files
--query jq expression to transform data
--item-query jq expression to extract items for iteration
--control Path to control file for path mappings
--dry-run Preview without writing files
--json Machine-readable JSON output

Modes

render automatically selects the appropriate mode:

  • File mode: Single template → single output
  • Directory mode: Template directory → output directory
  • Each mode: Template + item query → multiple outputs

Documentation

See the docs/ directory for comprehensive documentation:

Template Functions

render provides 80+ template functions including:

  • Casing: lower, upper, camelCase, snakeCase, kebabCase, pascalCase
  • String: trim, replace, split, join, contains, indent
  • Conversion: toString, toInt, toJson, fromJson
  • Collections: list, dict, keys, values, merge, sortAlpha
  • Math: add, sub, mul, div, max, min
  • Regex: regexMatch, regexReplace, regexFind

See Template Functions Reference for the complete list.

Man Pages

Generate and view man pages:

render gen man ./man
man ./man/render.1

License

MIT License - see LICENSE file for details.

Directories

Path Synopsis
cmd
render command
Package main provides the entry point for the render CLI.
Package main provides the entry point for the render CLI.
internal
cli
Package cli provides the command-line interface for render.
Package cli provides the command-line interface for render.
config
Package config provides configuration loading for .render.yaml files.
Package config provides configuration loading for .render.yaml files.
data
Package data provides JSON and YAML data loading functionality.
Package data provides JSON and YAML data loading functionality.
engine
Package engine provides the template rendering engine.
Package engine provides the template rendering engine.
funcs
Package funcs provides custom template functions for text manipulation.
Package funcs provides custom template functions for text manipulation.
output
Package output provides file writing functionality with change detection.
Package output provides file writing functionality with change detection.
render
Package render provides two-phase template rendering with validation.
Package render provides two-phase template rendering with validation.
walker
Package walker provides directory traversal and template rendering functionality.
Package walker provides directory traversal and template rendering functionality.
tools
package command
Package main provides a CLI tool for creating distribution packages.
Package main provides a CLI tool for creating distribution packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL