⚙️ Move preferred formatter to its own config field
This commit is contained in:
parent
ce83cf1cc2
commit
cfeab035d3
6 changed files with 12 additions and 7 deletions
|
|
@ -17,9 +17,8 @@ var formatterMap = map[string]formatMaker{
|
|||
}
|
||||
|
||||
func Preferred(ctx context.Context) (f Formatter, err error) {
|
||||
v, _ := config.RetrieveFromContext(ctx)
|
||||
format := v.GetString("output.stdout.config.format")
|
||||
return New(ctx, format)
|
||||
_, c := config.RetrieveFromContext(ctx)
|
||||
return New(ctx, c.Formatters.Preferred)
|
||||
}
|
||||
|
||||
func New(ctx context.Context, kind string) (f Formatter, err error) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func setupNewTest(t *testing.T) context.Context {
|
|||
t.Helper()
|
||||
v := viper.New()
|
||||
v.SetConfigType("toml")
|
||||
v.Set("output.stdout.config.format", "plain")
|
||||
v.Set("formatters.preferred", "plain")
|
||||
v.Set("formatters.json.pretty_print", false)
|
||||
return config.AddToContext(t.Context(), v)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue