Skip to content

Commit bc29144

Browse files
committed
prompt: support case-insensitive sorting
1 parent f145d30 commit bc29144

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/azd/pkg/prompt/prompter.go

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"log"
1111
"os"
1212
"slices"
13+
"sort"
1314
"strconv"
1415
"strings"
1516

@@ -218,6 +219,10 @@ func (p *DefaultPrompter) getSubscriptionOptions(ctx context.Context) ([]string,
218219
return nil, nil, nil, fmt.Errorf("listing accounts: %w", err)
219220
}
220221

222+
sort.Slice(subscriptionInfos, func(i, j int) bool {
223+
return strings.ToLower(subscriptionInfos[i].Name) < strings.ToLower(subscriptionInfos[j].Name)
224+
})
225+
221226
// The default value is based on AZURE_SUBSCRIPTION_ID, falling back to whatever default subscription in
222227
// set in azd's config.
223228
defaultSubscriptionId := os.Getenv(environment.SubscriptionIdEnvVarName)

0 commit comments

Comments
 (0)