mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-24 16:11:04 +00:00
Merge pull request #390 from jesseduffield/fix-port-flickering
This commit is contained in:
commit
2ecfc5d0dc
1 changed files with 6 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -58,7 +59,7 @@ 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 {
|
||||||
if port.PublicPort == 0 {
|
if port.PublicPort == 0 {
|
||||||
return fmt.Sprintf("%d\\%s", port.PrivatePort, port.Type)
|
return fmt.Sprintf("%d/%s", port.PrivatePort, port.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// docker ps will show '0.0.0.0:80->80/tcp' but we'll show
|
// docker ps will show '0.0.0.0:80->80/tcp' but we'll show
|
||||||
|
|
@ -71,6 +72,10 @@ func (c *Container) displayPorts() string {
|
||||||
return fmt.Sprintf("%s%d->%d/%s", ipString, port.PublicPort, port.PrivatePort, port.Type)
|
return fmt.Sprintf("%s%d->%d/%s", ipString, port.PublicPort, port.PrivatePort, port.Type)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// sorting because the order of the ports is not deterministic
|
||||||
|
// and we don't want to have them constantly swapping
|
||||||
|
sort.Strings(portStrings)
|
||||||
|
|
||||||
return strings.Join(portStrings, ", ")
|
return strings.Join(portStrings, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue