Skip to content

Commit 8e3d5e7

Browse files
Address SelectProfile review feedback
- Restore StartInSearchMode for logout picker so profiles with 6+ entries auto-activate search, matching the previous behavior. - Improve empty-profiles error to suggest running 'databricks auth login' instead of the generic "no profiles to select from".
1 parent b6b668f commit 8e3d5e7

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

cmd/auth/logout.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ environment (e.g. CI/CD), omitting --profile is an error.
7878
return err
7979
}
8080
selected, err := profile.SelectProfile(ctx, profile.SelectConfig{
81-
Label: "Select a profile to log out of",
82-
Profiles: allProfiles,
83-
ActiveTemplate: `▸ {{.PaddedName | bold}}{{if .AccountID}} (account: {{.AccountID}}){{else}} ({{.Host}}){{end}}`,
84-
InactiveTemplate: ` {{.PaddedName}}{{if .AccountID}} (account: {{.AccountID | faint}}){{else}} ({{.Host | faint}}){{end}}`,
85-
SelectedTemplate: `{{ "Selected profile" | faint }}: {{ .Name | bold }}`,
81+
Label: "Select a profile to log out of",
82+
Profiles: allProfiles,
83+
StartInSearchMode: len(allProfiles) > 5,
84+
ActiveTemplate: `▸ {{.PaddedName | bold}}{{if .AccountID}} (account: {{.AccountID}}){{else}} ({{.Host}}){{end}}`,
85+
InactiveTemplate: ` {{.PaddedName}}{{if .AccountID}} (account: {{.AccountID | faint}}){{else}} ({{.Host | faint}}){{end}}`,
86+
SelectedTemplate: `{{ "Selected profile" | faint }}: {{ .Name | bold }}`,
8687
})
8788
if err != nil {
8889
return err

libs/databrickscfg/profile/select.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type selectItem struct {
4848
// selected profile.
4949
func SelectProfile(ctx context.Context, cfg SelectConfig) (string, error) {
5050
if len(cfg.Profiles) == 0 {
51-
return "", errors.New("no profiles to select from")
51+
return "", errors.New("no profiles configured. Run 'databricks auth login' to create a profile")
5252
}
5353

5454
maxNameLen := 0

0 commit comments

Comments
 (0)