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
@@ -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)
