Add AddFormatter function to allow custom builds to register new formatters

This commit is contained in:
Dan Jones 2026-03-09 16:11:53 -05:00
commit 17a1cf1ade
5 changed files with 60 additions and 31 deletions

View file

@ -10,6 +10,8 @@ import (
"github.com/spf13/viper"
)
const FormatJSON string = "json"
func newJson(ff *viper.Viper) (Formatter, error) {
js := new(Json)
err := ff.Unmarshal(js)
@ -24,7 +26,7 @@ type Json struct {
}
func (js *Json) Name() string {
return "json"
return FormatJSON
}
func (js *Json) marshal(v any) (o []byte, err error) {