(style string)
| 230 | } |
| 231 | |
| 232 | func getHandler(style string) (handler, error) { |
| 233 | switch style { |
| 234 | case "json": |
| 235 | return rewriteHandler{codec: json.NewCodec(json.WithIndent(" "))}, nil |
| 236 | case "yaml": |
| 237 | return appendHandler{codec: yaml.Codec{}}, nil |
| 238 | default: |
| 239 | return nil, fmt.Errorf("unsupported config style %s", style) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | type handler interface { |
| 244 | flags() int |
no test coverage detected