basic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 7

README

Basic Formatter

The basic formatter is a barebones formatter that simply takes the data provided, serializes it with gopkg.in/yaml.v3 and encodes it again. This provides a consistent output format that is very opinionated and cannot be configured.

Configuration

Key Default Description
indentation 2 The indentation level in spaces to use for the formatted yaml
include_document_start false Include --- at document start

Documentation

Index

Constants

View Source
const BasicFormatterType string = "basic"

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicFormatter

type BasicFormatter struct {
	Config *Config
}

func (*BasicFormatter) Format

func (f *BasicFormatter) Format(yamlContent []byte) ([]byte, error)

func (*BasicFormatter) Type

func (f *BasicFormatter) Type() string

type BasicFormatterFactory

type BasicFormatterFactory struct{}

func (*BasicFormatterFactory) NewDefault

func (f *BasicFormatterFactory) NewDefault() yamlfmt.Formatter

func (*BasicFormatterFactory) NewWithConfig

func (f *BasicFormatterFactory) NewWithConfig(configData map[string]interface{}) (yamlfmt.Formatter, error)

func (*BasicFormatterFactory) Type

func (f *BasicFormatterFactory) Type() string

type Config

type Config struct {
	Indent               int  `mapstructure:"indent"`
	IncludeDocumentStart bool `mapstructure:"include_document_start"`
}

func DefaultConfig

func DefaultConfig() *Config

Jump to

Keyboard shortcuts

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