Skip to content

Commit 5d503c3

Browse files
committed
feat: sort variables in print / list vars
1 parent c6b8542 commit 5d503c3

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

cmd/list/vars.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ func (cmd *varsCmd) RunListVars(f factory.Factory, cobraCmd *cobra.Command, args
8080
fmt.Sprintf("%v", value),
8181
})
8282
}
83+
sort.Slice(varRow, func(i, j int) bool {
84+
return varRow[i][0] < varRow[j][0]
85+
})
8386

8487
// No variable found
8588
if len(varRow) == 0 {

cmd/print.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/sirupsen/logrus"
1515
"io"
1616
"os"
17+
"sort"
1718

1819
"github.com/loft-sh/devspace/cmd/flags"
1920
"github.com/loft-sh/devspace/pkg/util/factory"
@@ -194,6 +195,9 @@ func printExtraInfo(config config.Config, dependencies []types.Dependency, log l
194195
fmt.Sprintf("%v", varValue),
195196
})
196197
}
198+
sort.Slice(values, func(i, j int) bool {
199+
return values[i][0] < values[j][0]
200+
})
197201

198202
if len(values) > 0 {
199203
logger.PrintTable(log, headerColumnNames, values)

0 commit comments

Comments
 (0)