LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gomplate

Flexible command-line template renderer

TLDR

Render a template file
$ gomplate -f [template.tmpl]
copy
Render with an environment datasource
$ gomplate -d [config=env:] -f [template.tmpl]
copy
Render from stdin
$ cat [template.tmpl] | gomplate
copy
Output to a file
$ gomplate -f [in.tmpl] -o [out.txt]
copy

SYNOPSIS

gomplate [*options*]

DESCRIPTION

gomplate is a template CLI built on Go templates. It can pull datasources from files, HTTP, environment variables, AWS/GCP metadata, Consul, Vault, and more, then render text configs, scripts, or manifests. Popular for generating Kubernetes YAML, dotenv files, and bootstrapping scripts without a full programming run.

PARAMETERS

-f, --file *path*

Template file (repeatable / dir modes available).
-o, --out *path*
Output file (default stdout).
-d, --datasource *alias=url*
Define a named datasource (e.g. config=file:///…, env:/).
-c, --context *alias=url*
Attach datasource into the template context.
--input-dir / --output-dir
Batch-render directory trees.
Extensive datasource URL schemes are documented at https://docs.gomplate.ca/

INSTALL

sudo apk add gomplate
copy
brew install gomplate
copy
nix profile install nixpkgs#gomplate
copy

CAVEATS

Template injection risks apply if templates or datasources are untrusted. Network datasources need connectivity and credentials. Syntax is Go text/template plus gomplate functions—not Jinja/Mustache.

SEE ALSO

envsubst(1), jinja2(1), ytt(1), helm(1)

RESOURCES

Copied to clipboard
Kai