hcl: github.com/hashicorp/hcl/hcl/printer Index | Files

package printer

import "github.com/hashicorp/hcl/hcl/printer"

Package printer implements printing of AST nodes to HCL format.

Index

Package Files

nodes.go printer.go

Variables

var DefaultConfig = Config{
    SpacesWidth: 2,
}

func Format Uses

func Format(src []byte) ([]byte, error)

Format formats src HCL and returns the result.

func Fprint Uses

func Fprint(output io.Writer, node ast.Node) error

Fprint "pretty-prints" an HCL node to output It calls Config.Fprint with default settings.

type ByPosition Uses

type ByPosition []*ast.CommentGroup

func (ByPosition) Len Uses

func (b ByPosition) Len() int

func (ByPosition) Less Uses

func (b ByPosition) Less(i, j int) bool

func (ByPosition) Swap Uses

func (b ByPosition) Swap(i, j int)

type Config Uses

type Config struct {
    SpacesWidth int // if set, it will use spaces instead of tabs for alignment
}

A Config node controls the output of Fprint.

func (*Config) Fprint Uses

func (c *Config) Fprint(output io.Writer, node ast.Node) error

Package printer imports 8 packages (graph) and is imported by 84 packages. Updated 2018-04-04. Refresh now. Tools for package owners.