Skip to content

Repository files navigation

text-template-cli

CLI for text/template of golang

Install

go install github.com/akm/text-template-cli@latest

Usage

$ text-template-cli --help
A simple CLI tool to render text templates.
This application is a tool to render text templates using Go's text/template package.
See https://pkg.go.dev/text/template for more information about template file.
SOURCE must be a file or a directory.
If SOURCE is a file, the rendered content will be written to the standard output, or will be written a file in the output directory when --output-directory is given.
If SOURCE is a directory, the rendered content will be written to the output directory.
You can use this application without any INPUT_FILE, but you can also pass JSON, YAML and/or .env files as INPUT FILE to render the template.
Usage:
text-template-cli SOURCE [INPUT_FILE...] [flags]
Flags:
-h, --help help for text-template-cli
-o, --output-directory string Output directory
-e, --template-ext strings Template file extensions (default [.tmpl])
-v, --version version for text-template-cli

Functions

  • Sprig functions are available.
  • External command functions are available.

External command functions

nameExecuteionOutput
stdoutExecute given commandstdout
stderrExecute given commandstderr
combinedoutExecute given commandstdout and stderr
shellExecute sh with -c and given commandstdout

See examples/README.md.tmpl.

Examples

See examples for more details.

If it doesnt't work

Check the path to sub-directory bin of go env GOPATH and ensure whether it is set in environment variable PATH . If you use asdf, you might need to do asdf reshim .

About

CLI for text/template of golang

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages