feat: unifood base with GET dishes #1

Merged
bissendorf merged 6 commits from feat/base into dev 2025-07-20 17:29:04 +00:00
25 changed files with 734 additions and 0 deletions
Showing only changes of commit 2e16c67321 - Show all commits

2
.vscode/launch.json vendored
View File

@ -11,7 +11,7 @@
"mode": "debug", "mode": "debug",
"program": "${workspaceFolder}/main.go", "program": "${workspaceFolder}/main.go",
"args": [ "args": [
"get", "menu" "get", "menu", "-o", "yaml", "--print-config", "true"
] ]
} }
] ]

View File

@ -6,7 +6,7 @@ import (
var Formatters = map[string]interfaces.Formatter{ var Formatters = map[string]interfaces.Formatter{
"json": &JsonFormatter{}, "json": &JsonFormatter{},
"yaml": nil, "yaml": &YamlFormatter{},
"go": &GoFormatter{}, "go": &GoFormatter{},
"table": nil, "table": nil,
} }

19
core/output/yaml.go Normal file
View 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
}

1
go.mod
View File

@ -5,6 +5,7 @@ go 1.24.0
require github.com/spf13/cobra v1.9.1 require github.com/spf13/cobra v1.9.1
require ( require (
github.com/goccy/go-yaml v1.18.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.7 // indirect github.com/spf13/pflag v1.0.7 // indirect
) )

2
go.sum
View File

@ -1,4 +1,6 @@
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=