tpl

command module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

tpl

Simple templating from environment 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: sprout

More functions:

  • toBool
  • countRune
  • pipeline compatible regex functions from sprout
    • 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
⌂ 换网址