sxcli.devSimple Extensible CLI
You are viewing an archived snapshot (v0.2.0). Switch to the current version →

sxcli.dev/fw/configfmt/yaml

go
go
import "sxcli.dev/fw/configfmt/yaml"

Package yaml provides the YAML config format provider: it transcodes .yaml/.yml configuration files to and from the core's native JSON. The provider is stateless — pure stream transforms per the ConfigFormatProvider contract — and is pulled into the closure only when a yaml config file actually matched:

code
text
import _ "sxcli.dev/fw/configfmt/yaml"

Index#

type YAML#

YAML is the provider service.

go
go
type YAML struct{}

func (*YAML) Extensions#

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

Extensions returns the file extensions this provider transcodes.

func (*YAML) FromJSON#

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

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

func (*YAML) ToJSON#

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.