cli.md

April 22, 2026 ยท View on GitHub

Command Overview

templjs provides three primary commands:

  • render
  • validate
  • init

Global flags:

  • -h, --help: show usage/help text
  • --version: print the CLI version
  • -q, --quiet: suppress non-error output
  • -v, --verbose: print diagnostic details
  • --json: machine-readable output envelopes

Architecture

render

Implementation:

templjs render --template <path> --input <path|-> [options]

Options:

  • -t, --template <path>
  • -i, --input <path>
  • -o, --output <path>
  • -w, --watch
  • --input-format <json|yaml|toml|xml>
  • --output-format <text|json|html|markdown>
  • --experimental-stream-json
  • --no-validate-input
  • --no-validate-output

Watch mode behavior:

  • --json --watch emits JSON envelopes for each render/error event.
  • --quiet --watch suppresses non-error output.
  • --verbose --watch keeps diagnostic logging enabled.

validate

Validates template syntax and optionally validates input data against a schema.

Implementation:

templjs validate --template <path> [--schema <path>] [--input <path>]

init

Bootstraps a starter template in your chosen format (Markdown, HTML, JSON, or YAML).

Implementation:

templjs init --format <markdown|html|json|yaml> [--output <path>]

Examples

Implementation jump points:

Render to stdout:

templjs render -t examples/markdown-report/template.md.tmpl -i examples/markdown-report/data.json

Render to file:

templjs render -t template.md.tmpl -i data.json -o out.md

Watch mode JSON output:

templjs --json render -t template.md.tmpl -i data.json --watch