summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-12-02 15:27:14 +0100
committerGitHub <noreply@github.com>2020-12-02 15:27:14 +0100
commit7210b86d9ee5aa38a07829e58038049d224cad61 (patch)
tree3c040ea73c85ff2797c1950d41adec3d37c78c7a /cmd
parentd28874b2f4bc4f522ed2dc63412e9ddfea011fac (diff)
parentc31a5c0d9c9db52f03caa443a3fdfdce194046e8 (diff)
downloadpodman-7210b86d9ee5aa38a07829e58038049d224cad61.tar.gz
podman-7210b86d9ee5aa38a07829e58038049d224cad61.tar.bz2
podman-7210b86d9ee5aa38a07829e58038049d224cad61.zip
Merge pull request #8549 from Luap99/network-id-support
Add support for network ids
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/networks/list.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index 6e6bbb07d..16ae980dc 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -37,6 +37,7 @@ var (
var (
networkListOptions entities.NetworkListOptions
filters []string
+ noTrunc bool
)
func networkListFlags(flags *pflag.FlagSet) {
@@ -45,6 +46,7 @@ func networkListFlags(flags *pflag.FlagSet) {
_ = networklistCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteJSONFormat)
flags.BoolVarP(&networkListOptions.Quiet, "quiet", "q", false, "display only names")
+ flags.BoolVar(&noTrunc, "no-trunc", false, "Do not truncate the network ID")
filterFlagName := "filter"
flags.StringArrayVarP(&filters, filterFlagName, "f", nil, "Provide filter values (e.g. 'name=podman')")
@@ -96,6 +98,7 @@ func networkList(cmd *cobra.Command, args []string) error {
"Version": "version",
"Plugins": "plugins",
"Labels": "labels",
+ "ID": "network id",
})
renderHeaders := true
row := "{{.Name}}\t{{.Version}}\t{{.Plugins}}\n"
@@ -155,3 +158,11 @@ func (n ListPrintReports) Labels() string {
}
return strings.Join(list, ",")
}
+
+func (n ListPrintReports) ID() string {
+ length := 12
+ if noTrunc {
+ length = 64
+ }
+ return network.GetNetworkID(n.Name)[:length]
+}