printer

package
v0.0.0-...-00b26d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2016 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package printer implements printing of AST nodes to HCL format.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	SpacesWidth: 2,
}

Functions

func Format

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

Format formats src HCL and returns the result.

func Fprint

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

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

Types

type ByPosition

type ByPosition []*ast.CommentGroup

func (ByPosition) Len

func (b ByPosition) Len() int

func (ByPosition) Less

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

func (ByPosition) Swap

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

type Config

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL