yamlfmt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

YAMLfmt

YAMLfmt is a compact, efficient, and comment-preserving YAML formatter built on top of kubernetes-sigs/yaml and go-yaml — the same core code used by kubectl.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ffmt

func Ffmt(in io.Reader, out io.Writer, opt ...Option) error

Ffmt reads unformatted yaml from in and writes formatted yaml to out

func NewEncoder

func NewEncoder(w io.Writer, opts ...Option) *yaml.Encoder

func NewReader

func NewReader(r io.Reader) io.Reader

NewReader returns a reader that transforms all CRLF in r to LF

func Sfmt

func Sfmt(in string, opt ...Option) (string, error)

Sfmt formats the input yaml string and returns it

func Transcode

func Transcode(in decoder, out encoder) (err error)

Transcode decodes and encodes every yaml document from in to out

Types

type CRLFTransformer

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

func (*CRLFTransformer) Reset

func (t *CRLFTransformer) Reset()

func (*CRLFTransformer) Transform

func (t *CRLFTransformer) Transform(dst, src []byte, atEOF bool) (j int, i int, err error)

type Option

type Option func(*yaml.Encoder)

func WithCompactSequenceStyle

func WithCompactSequenceStyle(compact bool) Option

func WithIndentSize

func WithIndentSize(size int) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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