Skip to content


Substitute Variables (subvars) is a small utility which provides a way to render any Go templates from command line recognizing the object being passed in and drawing attributes from the object to create wanted text. It is very useful for template driven configuration files.

It uses sprig v3 for template functions which provides additional functions apart from standard library.

Reading and Rendering

subvars [global options] command [command options] [arguments...]
  • Directory dir subcommand lets you render all files in a folder & subfolder, and writes the output to stdout. you can also set an output folder where rendered files will be saved instead of stdout with --out flag. The filename will be same. If the folder does not exist it will be created automatically.
  • subvars reads the template directly from stdin
  • Rendered output will be written to stdout

See the usage example for details.