mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
more concise showing of ports
This commit is contained in:
parent
5988ec5745
commit
a9d1694853
1 changed files with 8 additions and 1 deletions
|
|
@ -57,7 +57,14 @@ func (c *Container) GetDisplayStrings(isFocused bool) []string {
|
||||||
|
|
||||||
func (c *Container) displayPorts() string {
|
func (c *Container) displayPorts() string {
|
||||||
portStrings := lo.Map(c.Container.Ports, func(port types.Port, _ int) string {
|
portStrings := lo.Map(c.Container.Ports, func(port types.Port, _ int) string {
|
||||||
return fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)
|
// docker ps will show '0.0.0.0:80->80/tcp' but we'll show
|
||||||
|
// '80->80/tcp' instead to save space (unless the IP is something other than
|
||||||
|
// 0.0.0.0)
|
||||||
|
ipString := ""
|
||||||
|
if port.IP != "0.0.0.0" {
|
||||||
|
ipString = port.IP + ":"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s%d->%d/%s", ipString, port.PublicPort, port.PrivatePort, port.Type)
|
||||||
})
|
})
|
||||||
|
|
||||||
return strings.Join(portStrings, ", ")
|
return strings.Join(portStrings, ", ")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue