diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-03-19 21:09:31 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-03-27 15:43:56 +0200 |
commit | baa29f6534fcd324dbade7dd6c32c90547e3fa4f (patch) | |
tree | 71a7524c25365cfc4a7cc1bbaab9d63988525d5e /output/outputFormat.go | |
parent | c7c6b47ba8bb098cf9fac778f7818afba40a1e2f (diff) |
output: Rework the base template logic
Extract the logic to a testable function and add support for custom output types.
Fixes #2995
Diffstat (limited to 'output/outputFormat.go')
-rw-r--r-- | output/outputFormat.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/output/outputFormat.go b/output/outputFormat.go index 8c99aa139..cc04bcbe4 100644 --- a/output/outputFormat.go +++ b/output/outputFormat.go @@ -92,7 +92,7 @@ type Format struct { NoUgly bool } -func GetType(key string) (Format, bool) { +func GetFormat(key string) (Format, bool) { found, ok := builtInTypes[key] if !ok { found, ok = builtInTypes[strings.ToLower(key)] @@ -101,11 +101,11 @@ func GetType(key string) (Format, bool) { } // TODO(bep) outputs rewamp on global config? -func GetTypes(keys ...string) (Formats, error) { +func GetFormats(keys ...string) (Formats, error) { var types []Format for _, key := range keys { - tpe, ok := GetType(key) + tpe, ok := GetFormat(key) if !ok { return types, fmt.Errorf("OutputFormat with key %q not found", key) } |