✨ Add AddFormatter function to allow custom builds to register new formatters
This commit is contained in:
parent
0fbd64247a
commit
17a1cf1ade
5 changed files with 60 additions and 31 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue