(p *ProjectOptions, dockerCli command.Cli)
| 90 | } |
| 91 | |
| 92 | func configCommand(p *ProjectOptions, dockerCli command.Cli) *cobra.Command { |
| 93 | opts := configOptions{ |
| 94 | ProjectOptions: p, |
| 95 | } |
| 96 | cmd := &cobra.Command{ |
| 97 | Use: "config [OPTIONS] [SERVICE...]", |
| 98 | Short: "Parse, resolve and render compose file in canonical format", |
| 99 | PreRunE: Adapt(func(ctx context.Context, args []string) error { |
| 100 | if opts.quiet { |
| 101 | devnull, err := os.Open(os.DevNull) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | os.Stdout = devnull |
| 106 | } |
| 107 | if p.Compatibility { |
| 108 | opts.noNormalize = true |
| 109 | } |
| 110 | if opts.lockImageDigests { |
| 111 | opts.resolveImageDigests = true |
| 112 | } |
| 113 | return nil |
| 114 | }), |
| 115 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 116 | if opts.services { |
| 117 | return runServices(ctx, dockerCli, opts) |
| 118 | } |
| 119 | if opts.volumes { |
| 120 | return runVolumes(ctx, dockerCli, opts) |
| 121 | } |
| 122 | if opts.networks { |
| 123 | return runNetworks(ctx, dockerCli, opts) |
| 124 | } |
| 125 | if opts.models { |
| 126 | return runModels(ctx, dockerCli, opts) |
| 127 | } |
| 128 | if opts.hash != "" { |
| 129 | return runHash(ctx, dockerCli, opts) |
| 130 | } |
| 131 | if opts.profiles { |
| 132 | return runProfiles(ctx, dockerCli, opts, args) |
| 133 | } |
| 134 | if opts.images { |
| 135 | return runConfigImages(ctx, dockerCli, opts, args) |
| 136 | } |
| 137 | if opts.variables { |
| 138 | return runVariables(ctx, dockerCli, opts, args) |
| 139 | } |
| 140 | if opts.environment { |
| 141 | return runEnvironment(ctx, dockerCli, opts, args) |
| 142 | } |
| 143 | |
| 144 | if opts.Format == "" { |
| 145 | opts.Format = "yaml" |
| 146 | } |
| 147 | return runConfig(ctx, dockerCli, opts, args) |
| 148 | }), |
| 149 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
no test coverage detected