Documentation ¶
Index ¶
Constants ¶
View Source
const NumSpacesPerIndent = 1
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(ctx context.Context, cfg configuration.Configuration, fs afero.Fs, fle string) error
Process uses the hcl2 library to format the hcl file. This will attempt to parse the HCL file first to ensure that there are no syntax errors, before attempting to format it.
func FormatBytes ¶
func FormatBytes(cfg configuration.Configuration, src []byte) (io.Reader, error)
Types ¶
type Formatter ¶
type Formatter struct { }
func NewFormatter ¶
func NewFormatter() *Formatter
type Tokens ¶
type Tokens []*Token
func (Tokens) Columns ¶
Columns returns the number of columns (grapheme clusters) the token sequence occupies. The result is not meaningful if there are newline or single-line comment tokens in the sequence.
func (Tokens) WriteTo ¶
func (ts Tokens) WriteTo(wr io.Writer, cfg configuration.Configuration) (int64, error)
WriteTo takes an io.Writer and writes the bytes for each token to it, along with the spacing that separates each token. In other words, this allows serializing the tokens to a file or other such byte stream.
Click to show internal directories.
Click to hide internal directories.