From 38baf3d5e2bc5c1e8b216dc072ea1d3eaf5053b8 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Sat, 9 Jan 2021 16:54:41 +0100 Subject: Add Networks format placeholder to podman ps and pod ps `podman ps --format {{.Networks}}` will show all connected networks for this container. For `pod ps` it will show the infra container networks. Signed-off-by: Paul Holzinger --- cmd/podman/pods/ps.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cmd/podman/pods') diff --git a/cmd/podman/pods/ps.go b/cmd/podman/pods/ps.go index 99d324411..a27ab4859 100644 --- a/cmd/podman/pods/ps.go +++ b/cmd/podman/pods/ps.go @@ -191,6 +191,11 @@ func (l ListPodReporter) Labels() map[string]string { return l.ListPodsReport.Labels } +// Networks returns the infra container network names in string format +func (l ListPodReporter) Networks() string { + return strings.Join(l.ListPodsReport.Networks, ",") +} + // NumberOfContainers returns an int representation for // the number of containers belonging to the pod func (l ListPodReporter) NumberOfContainers() int { -- cgit v1.2.3-54-g00ecf