Documentation
¶
Overview ¶
Package stdlib implements the Terramate language functions.
Index ¶
- Constants
- func AbspathFunc(basedir string) function.Function
- func Functions(basedir string, experiments []string) map[string]function.Function
- func HCLDecode() function.Function
- func HCLEncode() function.Function
- func HCLExpressionFunc() function.Function
- func JoinListFunc() function.Function
- func JoinListInvalidArgumentTypeError(got string) error
- func JoinListInvalidElementTypeError(index int64, got string) error
- func JoinListInvalidListElementTypeError(index int64, got string) error
- func JoinListInvalidTupleElementTypeError(listIndex int64, elementIndex int, got string) error
- func Name(name string) string
- func NewUnslugErrorIndeterministic(slug string, candidates []string) error
- func NoFS(basedir string, experiments []string) map[string]function.Function
- func Regex() function.Function
- func SlugFunc() function.Function
- func TernaryFunc() function.Function
- func TomlDecode() function.Function
- func TomlEncode() function.Function
- func TreeErrorConflictingParentsValue(child, parent1, parent2 string) error
- func TreeErrorCycleDetected(path []string) error
- func TreeErrorCycleNode(node string) error
- func TreeErrorEmptyChild() error
- func TreeErrorEmptyParent() error
- func TreeErrorInvalidPairLength() error
- func TreeErrorNullChildValue() error
- func TreeErrorUnknownParentValue(parent, child string) error
- func TreeFunc() function.Function
- func TryFunc() function.Function
- func UnslugFunc() function.Function
- func VendorFunc(basedir, vendordir project.Path, stream chan<- event.VendorRequest) function.Function
- func VersionMatch() function.Function
Constants ¶
const ( TreeErrorInvalidInput errors.Kind = "tree: invalid input" TreeErrorConflictingParents errors.Kind = "tree: conflicting parents" TreeErrorUnknownParent errors.Kind = "tree: unknown parent" TreeErrorCycle errors.Kind = "tree: cycle detected" TreeErrorNullChild errors.Kind = "tree: null child" TreeErrorEmptyString errors.Kind = "tree: empty string" )
TreeError kinds for tm_tree function errors
const ( // ErrUnslugIndeterministic indicates that a slug maps to multiple dictionary entries ErrUnslugIndeterministic errors.Kind = "tm_unslug indeterministic mapping" // ErrUnslugInvalidDictionaryType indicates the dictionary contains non-string elements ErrUnslugInvalidDictionaryType errors.Kind = "tm_unslug invalid dictionary type" // ErrUnslugInvalidValueType indicates the value is not a string or list of strings ErrUnslugInvalidValueType errors.Kind = "tm_unslug invalid value type" // ErrUnslugInternal indicates an unexpected internal failure ErrUnslugInternal errors.Kind = "tm_unslug internal error" )
Error kinds for tm_unslug function
const ErrTomlDecode errors.Kind = "failed to decode toml content"
ErrTomlDecode represents errors happening during decoding of TOML content.
const JoinListInvalidArgumentType errors.Kind = "tm_joinlist: invalid argument type"
JoinListInvalidArgumentType is returned when the second argument to tm_joinlist is not a list or tuple.
const JoinListInvalidElementType errors.Kind = "tm_joinlist: invalid element type"
JoinListInvalidElementType is returned when an element in the list is not a list or tuple of strings.
const JoinListInvalidListElementType errors.Kind = "tm_joinlist: invalid list element type"
JoinListInvalidListElementType is returned when a list element contains non-string values.
const JoinListInvalidTupleElementType errors.Kind = "tm_joinlist: invalid tuple element type"
JoinListInvalidTupleElementType is returned when a tuple element contains non-string values.
const SlugListElementNotString errors.Kind = "tm_slug: list element not string"
SlugListElementNotString is returned when a list element is not a string.
const SlugWrongType errors.Kind = "tm_slug: wrong type"
SlugWrongType is returned when tm_slug receives an invalid type.
const TomlExperimentName = "toml-functions"
TomlExperimentName is the name for the TOML experiment.
Variables ¶
This section is empty.
Functions ¶
func AbspathFunc ¶
AbspathFunc returns the `tm_abspath()` hcl function.
func Functions ¶
Functions returns all the Terramate default functions. The `basedir` must be an absolute path for an existent directory or it panics.
func HCLExpressionFunc ¶
HCLExpressionFunc returns the tm_hcl_expression function. This function interprets the `expr` argument as a string and returns the parsed expression.
func JoinListFunc ¶ added in v0.14.5
JoinListFunc implements the `tm_joinlist()` function. tm_joinlist(separator: string, list_of_lists: list(list(string))) -> list(string) It joins each sublist in the list_of_lists using the separator.
func JoinListInvalidArgumentTypeError ¶ added in v0.14.5
JoinListInvalidArgumentTypeError creates an error for invalid argument type.
func JoinListInvalidElementTypeError ¶ added in v0.14.5
JoinListInvalidElementTypeError creates an error for invalid element type.
func JoinListInvalidListElementTypeError ¶ added in v0.14.5
JoinListInvalidListElementTypeError creates an error for invalid list element type.
func JoinListInvalidTupleElementTypeError ¶ added in v0.14.5
JoinListInvalidTupleElementTypeError creates an error for invalid tuple element type.
func NewUnslugErrorIndeterministic ¶ added in v0.14.5
NewUnslugErrorIndeterministic creates an error for when a slug maps to multiple dictionary entries
func NoFS ¶ added in v0.4.1
NoFS returns all Terramate functions but excluding fs-related functions.
func Regex ¶
Regex is a copy of Terraform stdlib.RegexFunc but with cached compiled patterns.
func SlugFunc ¶ added in v0.14.5
SlugFunc returns the `tm_slug` function spec. It accepts either a string or list(string) and returns the appropriately typed slugified result.
func TernaryFunc ¶
TernaryFunc is the `tm_ternary` function implementation. The `tm_ternary(cond, expr1, expr2)` will return expr1 if `cond` evaluates to `true` and `expr2` otherwise.
func TomlDecode ¶ added in v0.10.3
TomlDecode implements the `tm_tomldecode` function.
func TomlEncode ¶ added in v0.10.3
TomlEncode implements the `tm_tomlencode()` function.
func TreeErrorConflictingParentsValue ¶ added in v0.14.5
TreeErrorConflictingParentsValue creates an error for conflicting parents
func TreeErrorCycleDetected ¶ added in v0.14.5
TreeErrorCycleDetected creates an error for cycle detection
func TreeErrorCycleNode ¶ added in v0.14.5
TreeErrorCycleNode creates a simple cycle error with just the node name
func TreeErrorEmptyChild ¶ added in v0.14.5
func TreeErrorEmptyChild() error
TreeErrorEmptyChild creates an error for empty child string
func TreeErrorEmptyParent ¶ added in v0.14.5
func TreeErrorEmptyParent() error
TreeErrorEmptyParent creates an error for empty parent string
func TreeErrorInvalidPairLength ¶ added in v0.14.5
func TreeErrorInvalidPairLength() error
TreeErrorInvalidPairLength creates an error for invalid pair length
func TreeErrorNullChildValue ¶ added in v0.14.5
func TreeErrorNullChildValue() error
TreeErrorNullChildValue creates an error for null child value
func TreeErrorUnknownParentValue ¶ added in v0.14.5
TreeErrorUnknownParentValue creates an error for unknown parent
func TreeFunc ¶ added in v0.14.5
TreeFunc returns the `tm_tree` function spec. This function builds a tree/forest from a list of [parent, child] pairs and returns all branch paths from root to each node.
func UnslugFunc ¶ added in v0.14.5
UnslugFunc returns the tm_unslug function.
func VendorFunc ¶
func VendorFunc(basedir, vendordir project.Path, stream chan<- event.VendorRequest) function.Function
VendorFunc returns the `tm_vendor` function. The basedir defines what tm_vendor will use to define the relative paths of vendored dependencies. The vendordir defines where modules are vendored inside the project. The stream defines the event stream for tm_vendor, one event is produced per successful function call.
func VersionMatch ¶
VersionMatch returns the `tm_version_match` function spec, which checks if the provided version matches the constraint. If the third argument is provided, then it uses the flags to customize the version matcher. At the moment, only the propery `allow_prereleases` is supported, which enables matchs against prereleases using default Semver ordering semantics.
Types ¶
This section is empty.