From a2d335271a267f5de94fc6cab735359a11c2dbe8 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 16 Feb 2021 14:01:56 +0100 Subject: [PATCH] introduce pull --quiet option Signed-off-by: Nicolas De Loof --- cli/cmd/compose/pull.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cli/cmd/compose/pull.go b/cli/cmd/compose/pull.go index 3617058e..3dca9eb7 100644 --- a/cli/cmd/compose/pull.go +++ b/cli/cmd/compose/pull.go @@ -18,7 +18,6 @@ package compose import ( "context" - "github.com/spf13/cobra" "github.com/docker/compose-cli/api/client" @@ -28,20 +27,22 @@ import ( type pullOptions struct { *projectOptions composeOptions + quiet bool } func pullCommand(p *projectOptions) *cobra.Command { opts := pullOptions{ projectOptions: p, } - pullCmd := &cobra.Command{ + cmd := &cobra.Command{ Use: "pull [SERVICE...]", Short: "Pull service images", RunE: func(cmd *cobra.Command, args []string) error { return runPull(cmd.Context(), opts, args) }, } - return pullCmd + cmd.Flags().BoolVarP(&opts.quiet, "quiet", "q", false, "Pull without printing progress information") + return cmd } func runPull(ctx context.Context, opts pullOptions, services []string) error { @@ -55,6 +56,10 @@ func runPull(ctx context.Context, opts pullOptions, services []string) error { return err } + if opts.quiet { + return c.ComposeService().Pull(ctx, project) + } + _, err = progress.Run(ctx, func(ctx context.Context) (string, error) { return "", c.ComposeService().Pull(ctx, project) })