feat: unifood base with GET dishes (#1)
Features: - CLI structure with verbs and resources - Application config and parameters - Output formatters - Initial resource: dishes Reviewed-on: #1 Co-authored-by: bdoerfchen <git@bissendorf.co> Co-committed-by: bdoerfchen <git@bissendorf.co>
This commit is contained in:
20
core/output/yaml.go
Normal file
20
core/output/yaml.go
Normal file
@ -0,0 +1,20 @@
|
||||
package output
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
|
||||
"git.bissendorf.co/bissendorf/unifood/m/v2/core/interfaces"
|
||||
"github.com/goccy/go-yaml"
|
||||
)
|
||||
|
||||
type YamlFormatter struct{}
|
||||
|
||||
func (f *YamlFormatter) Format(list *interfaces.ResourceList) (io.Reader, error) {
|
||||
buffer, err := yaml.Marshal(list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return bytes.NewBuffer(buffer), nil
|
||||
}
|
||||
Reference in New Issue
Block a user