MCPcopy
hub / github.com/cloudfoundry/cli / showStatus

Method showStatus

command/v7/login_command.go:396–439  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394}
395
396func (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
441func (cmd *LoginCommand) filterOrgsForSpace(allOrgs []resources.Organization) ([]resources.Organization, error) {
442 if cmd.Space == "" {

Callers 1

ExecuteMethod · 0.95

Calls 10

DisplayNotLoggedInTextFunction · 0.92
TranslateTextMethod · 0.65
TargetMethod · 0.65
APIVersionMethod · 0.65
GetCurrentUserMethod · 0.65
DisplayKeyValueTableMethod · 0.65
BinaryNameMethod · 0.65
DisplayTextMethod · 0.65
TargetedSpaceMethod · 0.65

Tested by

no test coverage detected