feat: yaml output formatter
This commit is contained in:
19
core/output/yaml.go
Normal file
19
core/output/yaml.go
Normal file
@ -0,0 +1,19 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"github.com/goccy/go-yaml"
|
||||
)
|
||||
|
||||
type YamlFormatter struct{}
|
||||
|
||||
func (f *YamlFormatter) Format(object any) (io.Reader, error) {
|
||||
buffer, err := yaml.Marshal(object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return bytes.NewBuffer(buffer), nil
|
||||
}
|
||||
Reference in New Issue
Block a user