mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
moved states outside Slice call
This commit is contained in:
parent
e585277c89
commit
0279534811
1 changed files with 5 additions and 5 deletions
|
|
@ -279,12 +279,12 @@ func (c *DockerCommand) filterOutExited(containers []*Container) []*Container {
|
||||||
// and sorted by name if c.SortContainersByState is false
|
// and sorted by name if c.SortContainersByState is false
|
||||||
func (c *DockerCommand) sortedContainers(containers []*Container) []*Container {
|
func (c *DockerCommand) sortedContainers(containers []*Container) []*Container {
|
||||||
if !c.Config.UserConfig.Gui.SortContainersByName {
|
if !c.Config.UserConfig.Gui.SortContainersByName {
|
||||||
|
states := map[string]int{
|
||||||
|
"running": 1,
|
||||||
|
"exited": 2,
|
||||||
|
"created": 3,
|
||||||
|
}
|
||||||
sort.Slice(containers, func(i, j int) bool {
|
sort.Slice(containers, func(i, j int) bool {
|
||||||
states := map[string]int{
|
|
||||||
"running": 1,
|
|
||||||
"exited": 2,
|
|
||||||
"created": 3,
|
|
||||||
}
|
|
||||||
return states[containers[i].Container.State] < states[containers[j].Container.State]
|
return states[containers[i].Container.State] < states[containers[j].Container.State]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue