MCPcopy Create free account
hub / github.com/docker/compose / combinedStatus

Function combinedStatus

pkg/compose/ls.go:95–116  ·  view source on GitHub ↗
(statuses []string)

Source from the content-addressed store, hash-verified

93}
94
95func combinedStatus(statuses []string) string {
96 nbByStatus := map[string]int{}
97 keys := []string{}
98 for _, status := range statuses {
99 nb, ok := nbByStatus[status]
100 if !ok {
101 nb = 0
102 keys = append(keys, status)
103 }
104 nbByStatus[status] = nb + 1
105 }
106 sort.Strings(keys)
107 result := ""
108 for _, status := range keys {
109 nb := nbByStatus[status]
110 if result != "" {
111 result += ", "
112 }
113 result += fmt.Sprintf("%s(%d)", status, nb)
114 }
115 return result
116}
117
118func groupContainerByLabel(containers []container.Summary, labelName string) (map[string][]container.Summary, []string, error) {
119 containersByLabel := map[string][]container.Summary{}

Callers 2

TestStacksMixedStatusFunction · 0.85
containersToStacksFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestStacksMixedStatusFunction · 0.68