From 0a05bbc84e8ebaea2157fe24773bf14ded59e7ce Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 2 Mar 2021 08:49:55 +0100 Subject: [PATCH] introduce pull --include-deps Signed-off-by: Nicolas De Loof --- cli/cmd/compose/pull.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/cmd/compose/pull.go b/cli/cmd/compose/pull.go index d7b8b7ddb..e09e179a4 100644 --- a/cli/cmd/compose/pull.go +++ b/cli/cmd/compose/pull.go @@ -28,7 +28,8 @@ import ( type pullOptions struct { *projectOptions composeOptions - quiet bool + quiet bool + includeDeps bool } func pullCommand(p *projectOptions) *cobra.Command { @@ -43,6 +44,7 @@ func pullCommand(p *projectOptions) *cobra.Command { }, } cmd.Flags().BoolVarP(&opts.quiet, "quiet", "q", false, "Pull without printing progress information") + cmd.Flags().BoolVar(&opts.includeDeps, "include-deps", false, "Also pull services declared as dependencies") return cmd } @@ -57,6 +59,15 @@ func runPull(ctx context.Context, opts pullOptions, services []string) error { return err } + if !opts.includeDeps { + enabled, err := project.GetServices(services...) + if err != nil { + return err + } + project.DisabledServices = append(project.DisabledServices, project.Services...) + project.Services = enabled + } + if opts.quiet { return c.ComposeService().Pull(ctx, project) }