Skip to content

Commit 792ed86

Browse files
committed
Sort output of listing search attributes
1 parent 569da5e commit 792ed86

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

internal/temporalcli/commands.operator_search_attribute.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package temporalcli
22

33
import (
44
"fmt"
5+
"slices"
56
"strings"
67

78
"github.com/fatih/color"
@@ -130,12 +131,17 @@ func (c *TemporalOperatorSearchAttributeListCommand) run(cctx *CommandContext, a
130131
Type: saType.String(),
131132
})
132133
}
134+
slices.SortFunc(sas, func(a, b saNameType) int { return strings.Compare(a.Name, b.Name) })
135+
136+
var csa []saNameType
133137
for saName, saType := range resp.CustomAttributes {
134-
sas = append(sas, saNameType{
138+
csa = append(csa, saNameType{
135139
Name: saName,
136140
Type: saType.String(),
137141
})
138142
}
143+
slices.SortFunc(csa, func(a, b saNameType) int { return strings.Compare(a.Name, b.Name) })
144+
sas = append(sas, csa...)
139145

140146
return cctx.Printer.PrintStructured(sas, printer.StructuredOptions{Table: &printer.TableOptions{}})
141147
}

0 commit comments

Comments
 (0)