text

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package text includes utilities for working with text that might contain variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsEnvVariables

func ContainsEnvVariables(inBytes []byte) bool

ContainsEnvVariables returns true if inBytes contains environment variable replace patterns.

func ContainsSpecialVariables

func ContainsSpecialVariables(inBytes []byte) bool

ContainsSpecialVariables returns true if inBytes contains special variable replace patterns.

func ReplaceEnvVariables

func ReplaceEnvVariables(inBytes []byte) []byte

ReplaceEnvVariables will search a blob of data for the pattern `${FOO:bar}`, where `FOO` is an environment variable name and `bar` is a default value. The `bar` section (including the colon) can be left out if there is no appropriate default value for the field.

For each aforementioned pattern found in the blob the contents of the respective environment variable will be read and will replace the pattern. If the environment variable is empty or does not exist then either the default value is used or the field will be left empty.

func ReplaceSpecialVariables

func ReplaceSpecialVariables(inBytes []byte) []byte

ReplaceSpecialVariables will search a blob of data for the pattern `${!foo}`, where `foo` is a special variable name.

For each aforementioned pattern found in the blob the contents of the respective special variable will be calculated and will replace the pattern.

Types

This section is empty.

Jump to

Keyboard shortcuts

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