tpl

command module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

tpl

Simple templating from envirionment variables.

Usage

Given the following sample file (sample.txt):

Hello {{ .Env.USER }}
$ tpl sample.txt
Hello saghul

The output is always stdout. This utility is means to be used as follows:

$ tpl nginx.conf.tpl > nginx.conf

Template context

Templates use Golang text/template.

You can access environment variables within a template in the .Env object.

There are some built-in functions as well: Masterminds/sprig v3

More functions:

  • toBool
  • countRune
  • pipeline compatible regex functions from sprig
    • reReplaceAll
    • reReplaceAllLiteral
    • reSplit

Thanks

This project is a fork of frep with a more limited scope. Thank you Guoqiang Chen for creating frep!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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