modulepackage
0.0.1
Repository: https://github.com/weakpixel/cty-function.git
Documentation: pkg.go.dev
# README
cty-function
# Functions
Basename takes a string containing a filesystem path and removes all except the last portion from it.
Dirname takes a string containing a filesystem path and removes the last portion from it.
File reads the contents of the file at the given path.
FileBase64 reads the contents of the file at the given path.
FileExists determines whether a file exists at the given path.
FileSet enumerates a set of files given a glob pattern
The underlying function implementation works relative to a particular base directory, so this wrapper takes a base directory string and uses it to construct the underlying function before calling it.
Functions returns the set of functions that should be used to when evaluating expressions in the receiving scope.
MakeFileExistsFunc constructs a function that takes a path and determines whether a file exists at that path.
MakeFileFunc constructs a function that takes a file path and returns the contents of that file, either directly as a string (where valid UTF-8 is required) or as a string containing base64 bytes.
MakeFileSetFunc constructs a function that takes a glob pattern and enumerates a file set from that pattern.
MakeTemplateFileFunc constructs a function that takes a file path and an arbitrary object of named values and attempts to render the referenced file as a template using HCL template syntax.
Pathexpand takes a string that might begin with a `~` segment, and if so it replaces that segment with the current user's home directory path.
# Variables
AbsPathFunc constructs a function that converts a filesystem path to an absolute path.
BasenameFunc constructs a function that takes a string containing a filesystem path and removes all except the last portion from it.
DirnameFunc constructs a function that takes a string containing a filesystem path and removes the last portion from it.
PathExpandFunc constructs a function that expands a leading ~ character to the current user's home directory.