| 519 | } |
| 520 | |
| 521 | func runVariables(ctx context.Context, dockerCli command.Cli, opts configOptions, services []string) error { |
| 522 | opts.noInterpolate = true |
| 523 | model, err := opts.ToModel(ctx, dockerCli, services, cli.WithoutEnvironmentResolution, cli.WithLoadOptions(loader.WithSkipValidation)) |
| 524 | if err != nil { |
| 525 | return err |
| 526 | } |
| 527 | |
| 528 | variables := template.ExtractVariables(model, template.DefaultPattern) |
| 529 | |
| 530 | if opts.Format == "yaml" { |
| 531 | result, err := yaml.Marshal(variables) |
| 532 | if err != nil { |
| 533 | return err |
| 534 | } |
| 535 | fmt.Print(string(result)) |
| 536 | return nil |
| 537 | } |
| 538 | |
| 539 | return formatter.Print(variables, opts.Format, dockerCli.Out(), func(w io.Writer) { |
| 540 | for name, variable := range variables { |
| 541 | _, _ = fmt.Fprintf(w, "%s\t%t\t%s\t%s\n", name, variable.Required, variable.DefaultValue, variable.PresenceValue) |
| 542 | } |
| 543 | }, "NAME", "REQUIRED", "DEFAULT VALUE", "ALTERNATE VALUE") |
| 544 | } |
| 545 | |
| 546 | func runEnvironment(ctx context.Context, dockerCli command.Cli, opts configOptions, services []string) error { |
| 547 | backend, err := compose.NewComposeService(dockerCli) |