mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Merge 540860445a into 7e7aadc207
This commit is contained in:
commit
28dc4f9cc7
2 changed files with 22 additions and 1 deletions
|
|
@ -142,6 +142,10 @@ type GuiConfig struct {
|
||||||
// Window border style.
|
// Window border style.
|
||||||
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
||||||
Border string `yaml:"border"`
|
Border string `yaml:"border"`
|
||||||
|
|
||||||
|
// SortEnv sorts the container Env panel alphabetically by key. Default false
|
||||||
|
// preserves the insertion order from the image / compose file.
|
||||||
|
SortEnv bool `yaml:"sortEnv,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommandTemplatesConfig determines what commands actually get called when we
|
// CommandTemplatesConfig determines what commands actually get called when we
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package gui
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -155,7 +156,23 @@ func (gui *Gui) containerEnv(container *commands.Container) string {
|
||||||
return gui.Tr.NothingToDisplay
|
return gui.Tr.NothingToDisplay
|
||||||
}
|
}
|
||||||
|
|
||||||
envVarsList := lo.Map(container.Details.Config.Env, func(envVar string, _ int) []string {
|
envVars := container.Details.Config.Env
|
||||||
|
if gui.Config.UserConfig.Gui.SortEnv {
|
||||||
|
envVars = append([]string(nil), envVars...)
|
||||||
|
sort.SliceStable(envVars, func(i, j int) bool {
|
||||||
|
ki := envVars[i]
|
||||||
|
if idx := strings.IndexByte(ki, '='); idx >= 0 {
|
||||||
|
ki = ki[:idx]
|
||||||
|
}
|
||||||
|
kj := envVars[j]
|
||||||
|
if idx := strings.IndexByte(kj, '='); idx >= 0 {
|
||||||
|
kj = kj[:idx]
|
||||||
|
}
|
||||||
|
return ki < kj
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
envVarsList := lo.Map(envVars, func(envVar string, _ int) []string {
|
||||||
splitEnv := strings.SplitN(envVar, "=", 2)
|
splitEnv := strings.SplitN(envVar, "=", 2)
|
||||||
key := splitEnv[0]
|
key := splitEnv[0]
|
||||||
value := ""
|
value := ""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue