output: Add output formats decoder

And clean up the output package.
This commit is contained in:
Bjørn Erik Pedersen 2017-04-03 17:00:23 +02:00
parent d6e8b86f66
commit c9aee467d3
6 changed files with 281 additions and 91 deletions

View file

@ -40,7 +40,7 @@ func createSiteOutputFormats(cfg config.Provider) (map[string]output.Formats, er
var formats output.Formats
vals := cast.ToStringSlice(v)
for _, format := range vals {
f, found := output.GetFormat(format)
f, found := output.DefaultFormats.GetByName(format)
if !found {
return nil, fmt.Errorf("Failed to resolve output format %q from site config", format)
}