()
| 394 | } |
| 395 | |
| 396 | func (cmd *LoginCommand) showStatus() { |
| 397 | tableContent := [][]string{ |
| 398 | { |
| 399 | cmd.UI.TranslateText("API endpoint:"), |
| 400 | strings.TrimRight(cmd.Config.Target(), "/"), |
| 401 | }, |
| 402 | { |
| 403 | cmd.UI.TranslateText("API version:"), |
| 404 | cmd.Config.APIVersion(), |
| 405 | }, |
| 406 | } |
| 407 | |
| 408 | user, err := cmd.Actor.GetCurrentUser() |
| 409 | if user.Name == "" || err != nil { |
| 410 | cmd.UI.DisplayKeyValueTable("", tableContent, 3) |
| 411 | command.DisplayNotLoggedInText(cmd.Config.BinaryName(), cmd.UI) |
| 412 | return |
| 413 | } |
| 414 | tableContent = append(tableContent, []string{cmd.UI.TranslateText("user:"), user.Name}) |
| 415 | |
| 416 | orgName := cmd.Config.TargetedOrganizationName() |
| 417 | if orgName == "" { |
| 418 | cmd.UI.DisplayKeyValueTable("", tableContent, 3) |
| 419 | cmd.UI.DisplayText("No org or space targeted, use '{{.CFTargetCommand}} -o ORG -s SPACE'", |
| 420 | map[string]interface{}{ |
| 421 | "CFTargetCommand": fmt.Sprintf("%s target", cmd.Config.BinaryName()), |
| 422 | }, |
| 423 | ) |
| 424 | return |
| 425 | } |
| 426 | tableContent = append(tableContent, []string{cmd.UI.TranslateText("org:"), orgName}) |
| 427 | |
| 428 | spaceContent := cmd.Config.TargetedSpace().Name |
| 429 | if spaceContent == "" { |
| 430 | spaceContent = cmd.UI.TranslateText("No space targeted, use '{{.Command}}'", |
| 431 | map[string]interface{}{ |
| 432 | "Command": fmt.Sprintf("%s target -s SPACE", cmd.Config.BinaryName()), |
| 433 | }, |
| 434 | ) |
| 435 | } |
| 436 | tableContent = append(tableContent, []string{cmd.UI.TranslateText("space:"), spaceContent}) |
| 437 | |
| 438 | cmd.UI.DisplayKeyValueTable("", tableContent, 3) |
| 439 | } |
| 440 | |
| 441 | func (cmd *LoginCommand) filterOrgsForSpace(allOrgs []resources.Organization) ([]resources.Organization, error) { |
| 442 | if cmd.Space == "" { |
no test coverage detected