refactor: updated cache editor implementation

This commit is contained in:
David Allen 2025-06-16 16:19:43 -06:00
parent 3bae20832f
commit e85fd21922
Signed by: towk
GPG key ID: 0430CDBE22619155
6 changed files with 78 additions and 28 deletions

View file

@ -15,6 +15,10 @@ type Model struct {
Table table.Model
}
func NewModel() Model {
return Model{}
}
func (m Model) Init() tea.Cmd { return nil }
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

View file

@ -3,6 +3,7 @@ package util
import (
"encoding/json"
"fmt"
"strings"
"github.com/rs/zerolog/log"
"gopkg.in/yaml.v2"
@ -23,3 +24,22 @@ func PrintYAML(data any) {
}
fmt.Print(string(b))
}
func PrintMap(data map[string]any) {
for k, v := range data {
fmt.Printf("%s: %v\n", k, v)
}
}
func PrintMapWithFormat(data map[string]any, format string) {
switch strings.ToLower(format) {
case "json":
PrintJSON(data)
case "yaml":
PrintYAML(data)
case "list":
PrintMap(data)
default:
log.Error().Msg("PrintMapWithFormat: unrecognized format")
}
}