Package fmt contains functions for formatting hcl config.
ErrHCLSyntax is the error kind for syntax errors.
ErrReadFile is the error kind for any error related to reading the file content.
This section is empty.
Format will format the given source code using hcl.Format. It returns an error if the given source is invalid HCL.
FormatAttributes will format a given attribute map to a string. Name of the attributes are the keys and the corresponding value is mapped. The formatted output will always be lexicographically sorted by the attribute name, so calling this function with the same map multiple times produces the same result.
FormatMultiline will format the given source code. It enforces lists to be formatted as multiline, where each element on the list resides on its own line followed by a comma.
It returns an error if the given source is invalid HCL.
type FormatResult struct { }
FormatResult represents the result of a formatting operation.
FormatFiles will format all the provided Terramate paths. Only Terramate configuration files can be reliably formatted with this function. If HCL files for a different tool is provided, the result is unpredictable.
Note: The provided file paths can be absolute or relative. If relative, ensure working directory is corrected adjusted. The special `-` filename is treated as a normal filename, then if it needs to be interpreted as `stdin` this needs to be handled separately by the caller.
Files that are already formatted are ignored. If all files are formatted this function returns an empty result.
All files will be left untouched. To save the formatted result on disk you can use FormatResult.Save for each FormatResult.
FormatTree will format all Terramate configuration files in the given tree starting at the given dir. It will recursively navigate on sub directories. Directories starting with "." are ignored.
Only Terramate configuration files will be formatted.
Files that are already formatted are ignored. If all files are formatted this function returns an empty result.
All files will be left untouched. To save the formatted result on disk you can use FormatResult.Save for each FormatResult.
Formatted is the contents of the original file after formatting.
Path is the absolute path of the original file.
Save will save the formatted result on the original file, replacing its original contents.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4