Skip to content

Commit

Permalink
feat: sort health services (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel authored Jul 29, 2024
1 parent 4a0535e commit d341b5c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/output/healthprinter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"sort"

"github.com/fi-ts/cloud-go/api/models"
"golang.org/x/exp/maps"
)

type (
Expand Down Expand Up @@ -60,7 +61,11 @@ func (p HealthTablePrinter) PrintServices(services map[string]models.RestHealthR
p.addShortData(wide, s)

i := 0
for sname, sresult := range s.Services {
skeys := maps.Keys(s.Services)
sort.Strings(skeys)

for _, sname := range skeys {
sresult := s.Services[sname]
prefix := "├"
if i == len(s.Services)-1 {
prefix = "└"
Expand Down

0 comments on commit d341b5c

Please sign in to comment.