(model map[string]any, format string)
| 333 | } |
| 334 | |
| 335 | func formatModel(model map[string]any, format string) (content []byte, err error) { |
| 336 | switch format { |
| 337 | case "json": |
| 338 | return json.MarshalIndent(model, "", " ") |
| 339 | case "yaml": |
| 340 | buf := bytes.NewBuffer([]byte{}) |
| 341 | encoder := yaml.NewEncoder(buf) |
| 342 | encoder.SetIndent(2) |
| 343 | err = encoder.Encode(model) |
| 344 | return buf.Bytes(), err |
| 345 | default: |
| 346 | return nil, fmt.Errorf("unsupported format %q", format) |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions) error { |
| 351 | if opts.noInterpolate { |
no test coverage detected