From 59abb77fc26bd93d1b8a33ad3baaf159d96a0691 Mon Sep 17 00:00:00 2001 From: Mehul Arora Date: Sat, 26 Jun 2021 16:47:49 +0530 Subject: multiple image pull support Signed-off-by: Mehul Arora --- cmd/podman/images/pull.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'cmd/podman/images') diff --git a/cmd/podman/images/pull.go b/cmd/podman/images/pull.go index a831ea848..a4e3515db 100644 --- a/cmd/podman/images/pull.go +++ b/cmd/podman/images/pull.go @@ -10,6 +10,7 @@ import ( "github.com/containers/image/v5/types" "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" + "github.com/containers/podman/v3/cmd/podman/utils" "github.com/containers/podman/v3/pkg/domain/entities" "github.com/containers/podman/v3/pkg/util" "github.com/pkg/errors" @@ -32,8 +33,8 @@ var ( // Command: podman pull pullCmd = &cobra.Command{ - Use: "pull [options] IMAGE", - Args: cobra.ExactArgs(1), + Use: "pull [options] IMAGE [IMAGE...]", + Args: cobra.MinimumNArgs(1), Short: "Pull an image from a registry", Long: pullDescription, RunE: imagePull, @@ -154,17 +155,16 @@ func imagePull(cmd *cobra.Command, args []string) error { } // Let's do all the remaining Yoga in the API to prevent us from // scattering logic across (too) many parts of the code. - pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), args[0], pullOptions.ImagePullOptions) - if err != nil { - return err - } - - if len(pullReport.Images) > 1 { - fmt.Println("Pulled Images:") - } - for _, img := range pullReport.Images { - fmt.Println(img) + var errs utils.OutputErrors + for _, arg := range args { + pullReport, err := registry.ImageEngine().Pull(registry.GetContext(), arg, pullOptions.ImagePullOptions) + if err != nil { + errs = append(errs, err) + continue + } + for _, img := range pullReport.Images { + fmt.Println(img) + } } - - return nil + return errs.PrintErrors() } -- cgit v1.2.3-54-g00ecf