mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
feat: show container name alongside service name when different
When a service has a custom container_name set in docker-compose.yml that differs from the service name, the Services panel now shows both: frontend (web_app) instead of just: frontend Fixes #40
This commit is contained in:
parent
7e7aadc207
commit
df15d1dd99
1 changed files with 8 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package presentation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/jesseduffield/lazydocker/pkg/commands"
|
||||
"github.com/jesseduffield/lazydocker/pkg/config"
|
||||
|
|
@ -32,10 +34,15 @@ func GetServiceDisplayStrings(guiConfig *config.GuiConfig, service *commands.Ser
|
|||
}
|
||||
|
||||
container := service.Container
|
||||
displayName := service.Name
|
||||
if container.Name != "" && container.Name != service.Name {
|
||||
displayName = fmt.Sprintf("%s (%s)", service.Name, container.Name)
|
||||
}
|
||||
|
||||
return []string{
|
||||
getContainerDisplayStatus(guiConfig, container),
|
||||
getContainerDisplaySubstatus(guiConfig, container),
|
||||
service.Name,
|
||||
displayName,
|
||||
getDisplayCPUPerc(container),
|
||||
utils.ColoredString(displayPorts(container), color.FgYellow),
|
||||
utils.ColoredString(displayContainerImage(container), color.FgMagenta),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue