From 3eb1d3c08a05d8cbdcdb7ce9594339b142a679d7 Mon Sep 17 00:00:00 2001 From: baude Date: Wed, 27 Feb 2019 20:31:01 -0600 Subject: podman port fix output list a portion of the container id and the ports exposed on the same line. when using all, if no ports are exposed, do not list the container id. Also, shorten the container id to a len of 12 like other container commands. Fixes bugzilla #1683734 Signed-off-by: baude --- cmd/podman/port.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/podman/port.go b/cmd/podman/port.go index 1c3086536..ffb5749fb 100644 --- a/cmd/podman/port.go +++ b/cmd/podman/port.go @@ -128,9 +128,6 @@ func portCmd(c *cliconfig.PortValues) error { if state, _ := con.State(); state != libpod.ContainerStateRunning { continue } - if c.All { - fmt.Println(con.ID()) - } portmappings, err := con.PortMappings() if err != nil { @@ -143,6 +140,9 @@ func portCmd(c *cliconfig.PortValues) error { if hostIP == "" { hostIP = "0.0.0.0" } + if c.All { + fmt.Printf("%s\t", con.ID()[:12]) + } // If not searching by port or port/proto, then dump what we see if port == "" { fmt.Printf("%d/%s -> %s:%d\n", v.ContainerPort, v.Protocol, hostIP, v.HostPort) -- cgit v1.2.3-54-g00ecf