diff --git a/command/eval_status.go b/command/eval_status.go index bffe62cb0..4b3f738c7 100644 --- a/command/eval_status.go +++ b/command/eval_status.go @@ -5,6 +5,7 @@ package command import ( "fmt" + "slices" "sort" "strconv" "strings" @@ -382,8 +383,16 @@ func formatPlanAnnotations(desiredTGUpdates map[string]*api.DesiredUpdates, verb } } + taskGroups := []string{} + for tg := range desiredTGUpdates { + taskGroups = append(taskGroups, tg) + } + slices.Sort(taskGroups) + i := 1 - for tg, updates := range desiredTGUpdates { + for _, tg := range taskGroups { + updates := desiredTGUpdates[tg] + // we always show the first 5 columns annotations[i] = fmt.Sprintf("%s|%d|%d|%d|%d|%d", tg, diff --git a/command/eval_status_test.go b/command/eval_status_test.go index 096007f95..582ed6399 100644 --- a/command/eval_status_test.go +++ b/command/eval_status_test.go @@ -236,6 +236,6 @@ func TestEvalStatus_FormatPlanAnnotations(t *testing.T) { out := formatPlanAnnotations(updates, false) must.Eq(t, `Task Group Ignore Place Stop InPlace Destructive Canary Reconnect -foo 2 1 0 0 0 1 0 -bar 0 1 3 0 0 0 2`, out) +bar 0 1 3 0 0 0 2 +foo 2 1 0 0 0 1 0`, out) }