sxcli.devSimple Extensible CLI

sxcli.dev/conf/yaml

go
go
import "sxcli.dev/conf/yaml"

Package yaml is the ready-made YAML format provider: stateless stream transforms between .yaml/.yml documents and the engine's native JSON.

code
text
l, served := conf.NewLoader("mytool", &cfg).Provider(&yaml.YAML{}).Load()

Index#

type YAMLsrc#

YAML transcodes yaml to and from the native JSON.

go
go
type YAML struct{}

func (*YAML) Extensionssrc#

go
go
func (p *YAML) Extensions() []string

Extensions returns the file extensions this provider transcodes.

func (*YAML) FromJSONsrc#

go
go
func (p *YAML) FromJSON(in io.Reader) (io.Reader, error)

FromJSON converts json back to yaml, serving --write-config.

func (*YAML) ToJSONsrc#

go
go
func (p *YAML) ToJSON(in io.Reader) (io.Reader, error)

ToJSON converts one yaml document to json. Config files are small, so the stream is slurped.