diff options
author | Mehul Arora <aroram18@mcmaster.ca> | 2021-06-26 16:47:49 +0530 |
---|---|---|
committer | Mehul Arora <aroram18@mcmaster.ca> | 2021-07-05 16:07:49 +0530 |
commit | 59abb77fc26bd93d1b8a33ad3baaf159d96a0691 (patch) | |
tree | f48498628a3179c7df4758570aaa9ae2b045a915 /cmd/podman | |
parent | 955c1d2bfeac0c399bbc4d82fd7b72ed4cc868d3 (diff) | |
download | podman-59abb77fc26bd93d1b8a33ad3baaf159d96a0691.tar.gz podman-59abb77fc26bd93d1b8a33ad3baaf159d96a0691.tar.bz2 podman-59abb77fc26bd93d1b8a33ad3baaf159d96a0691.zip |
multiple image pull support
Signed-off-by: Mehul Arora <aroram18@mcmaster.ca>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/images/pull.go | 28 |
1 files changed, 14 insertions, 14 deletions
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() } |