basic

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 11

README

Basic Formatter

For formatter settings, see the configuration docs.

Documentation

Index

Constants

View Source
const BasicFormatterType string = "basic"

Variables

This section is empty.

Functions

func ConfigureFeaturesFromConfig added in v0.4.0

func ConfigureFeaturesFromConfig(config *Config) yamlfmt.FeatureList

func ConfigureYAMLFeaturesFromConfig added in v0.6.0

func ConfigureYAMLFeaturesFromConfig(config *Config) yamlFeatures.YAMLFeatureList

Types

type BasicFormatter

type BasicFormatter struct {
	Config       *Config
	Features     yamlfmt.FeatureList
	YAMLFeatures yamlFeature.YAMLFeatureList
}

func (*BasicFormatter) ConfigMap added in v0.13.0

func (f *BasicFormatter) ConfigMap() (map[string]any, error)

func (*BasicFormatter) Format

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

func (*BasicFormatter) Type

func (f *BasicFormatter) Type() string

type BasicFormatterError added in v0.5.0

type BasicFormatterError struct {
	// contains filtered or unexported fields
}

func (BasicFormatterError) Error added in v0.5.0

func (e BasicFormatterError) Error() string

func (BasicFormatterError) Unwrap added in v0.5.0

func (e BasicFormatterError) Unwrap() error

type BasicFormatterFactory

type BasicFormatterFactory struct{}

func (*BasicFormatterFactory) NewFormatter added in v0.5.0

func (f *BasicFormatterFactory) NewFormatter(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"`
	LineEnding                yamlfmt.LineBreakStyle     `mapstructure:"line_ending"`
	LineLength                int                        `mapstructure:"max_line_length"`
	RetainLineBreaks          bool                       `mapstructure:"retain_line_breaks"`
	RetainLineBreaksSingle    bool                       `mapstructure:"retain_line_breaks_single"`
	DisallowAnchors           bool                       `mapstructure:"disallow_anchors"`
	ScanFoldedAsLiteral       bool                       `mapstructure:"scan_folded_as_literal"`
	IndentlessArrays          bool                       `mapstructure:"indentless_arrays"`
	DropMergeTag              bool                       `mapstructure:"drop_merge_tag"`
	PadLineComments           int                        `mapstructure:"pad_line_comments"`
	TrimTrailingWhitespace    bool                       `mapstructure:"trim_trailing_whitespace"`
	EOFNewline                bool                       `mapstructure:"eof_newline"`
	StripDirectives           bool                       `mapstructure:"strip_directives"`
	ArrayIndent               int                        `mapstructure:"array_indent"`
	IndentRootArray           bool                       `mapstructure:"indent_root_array"`
	DisableAliasKeyCorrection bool                       `mapstructure:"disable_alias_key_correction"`
	ForceArrayStyle           yamlFeatures.SequenceStyle `mapstructure:"force_array_style"`
}

func DefaultConfig

func DefaultConfig() *Config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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