mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
fix(config): Print service names with --no-interpolate
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
This commit is contained in:
parent
6313365ba4
commit
eba3ff8f37
@ -279,6 +279,22 @@ func formatModel(model map[string]any, format string) (content []byte, err error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions) error {
|
func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions) error {
|
||||||
|
if opts.noInterpolate {
|
||||||
|
// we can't use ToProject, so the model we render here is only partially resolved
|
||||||
|
data, err := opts.ToModel(ctx, dockerCli, nil, cli.WithoutEnvironmentResolution)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := data["services"]; ok {
|
||||||
|
for serviceName := range data["services"].(map[string]any) {
|
||||||
|
_, _ = fmt.Fprintln(dockerCli.Out(), serviceName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
project, err := opts.ToProject(ctx, dockerCli, nil, cli.WithoutEnvironmentResolution)
|
project, err := opts.ToProject(ctx, dockerCli, nil, cli.WithoutEnvironmentResolution)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -287,6 +303,7 @@ func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions)
|
|||||||
_, _ = fmt.Fprintln(dockerCli.Out(), serviceName)
|
_, _ = fmt.Fprintln(dockerCli.Out(), serviceName)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user