diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-05-24 13:18:56 +0200 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-05-24 16:07:39 +0200 |
commit | 5268314e5376c3da7a1123ee1954b466baf2d911 (patch) | |
tree | e523b93b34538faf7df9562143819eaab18696dd /cmd/podman/images | |
parent | d3d3a207de06935f77edd937980e2540f62bc11c (diff) | |
download | podman-5268314e5376c3da7a1123ee1954b466baf2d911.tar.gz podman-5268314e5376c3da7a1123ee1954b466baf2d911.tar.bz2 podman-5268314e5376c3da7a1123ee1954b466baf2d911.zip |
podman image mount: print pretty table
Make sure that `podman image mount` prints a pretty table unless there
is only argument passed and without a custom format. Fixing a TODO item
brought me to the specific code location and revealed the fart in the
logic.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'cmd/podman/images')
-rw-r--r-- | cmd/podman/images/mount.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/cmd/podman/images/mount.go b/cmd/podman/images/mount.go index d5ab3d274..532d96196 100644 --- a/cmd/podman/images/mount.go +++ b/cmd/podman/images/mount.go @@ -7,7 +7,6 @@ import ( "github.com/containers/common/pkg/report" "github.com/containers/podman/v4/cmd/podman/common" "github.com/containers/podman/v4/cmd/podman/registry" - "github.com/containers/podman/v4/cmd/podman/utils" "github.com/containers/podman/v4/pkg/domain/entities" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -71,16 +70,12 @@ func mount(cmd *cobra.Command, args []string) error { return err } - if len(args) > 0 || mountOpts.All { - var errs utils.OutputErrors - for _, r := range reports { - if r.Err == nil { - fmt.Println(r.Path) - continue - } - errs = append(errs, r.Err) + if len(args) == 1 && mountOpts.Format == "" && !mountOpts.All { + if len(reports) != 1 { + return fmt.Errorf("internal error: expected 1 report but got %d", len(reports)) } - return errs.PrintErrors() + fmt.Println(reports[0].Path) + return nil } switch { |