You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/oc/cli/cmd/login/loginoptions.go
+15-8Lines changed: 15 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ import (
34
34
35
35
constdefaultClusterURL="https://localhost:8443"
36
36
37
+
constprojectsItemsSurpressThreshold=50
38
+
37
39
// LoginOptions is a helper for the login and setup process, gathers all information required for a
38
40
// successful login and eventual update of config files.
39
41
// Depending on the Reader present it can be interactive, asking for terminal input in
@@ -316,16 +318,21 @@ func (o *LoginOptions) gatherProjectInfo() error {
316
318
returnerr
317
319
}
318
320
o.Project=current.Name
319
-
320
-
fmt.Fprintf(o.Out, "You have access to the following projects and can switch between them with '%s project <projectname>':\n\n", o.CommandName)
321
-
for_, p:=rangeprojects.List() {
322
-
ifo.Project==p {
323
-
fmt.Fprintf(o.Out, " * %s\n", p)
324
-
} else {
325
-
fmt.Fprintf(o.Out, " %s\n", p)
321
+
322
+
// Surpress project listing if the number of projects available to the user is greater than the threshold. Prevents unnecessarily noisy logins on clusters with large numbers of projects
fmt.Fprintf(o.Out, "You have access to %d projects, the list has been surpressed. You can list all projects with '%s projects'\n", len(projectsItems), o.CommandName)
325
+
} else {
326
+
fmt.Fprintf(o.Out, "You have access to the following projects and can switch between them with '%s project <projectname>':\n\n", o.CommandName)
0 commit comments