(args []string)
| 18 | } |
| 19 | |
| 20 | func (cmd AppsCommand) Execute(args []string) error { |
| 21 | err := cmd.SharedActor.CheckTarget(true, true) |
| 22 | if err != nil { |
| 23 | return err |
| 24 | } |
| 25 | |
| 26 | user, err := cmd.Actor.GetCurrentUser() |
| 27 | if err != nil { |
| 28 | return err |
| 29 | } |
| 30 | |
| 31 | cmd.UI.DisplayTextWithFlavor("Getting apps in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{ |
| 32 | "OrgName": cmd.Config.TargetedOrganization().Name, |
| 33 | "SpaceName": cmd.Config.TargetedSpace().Name, |
| 34 | "Username": user.Name, |
| 35 | }) |
| 36 | cmd.UI.DisplayNewline() |
| 37 | |
| 38 | summaries, warnings, err := cmd.Actor.GetAppSummariesForSpace(cmd.Config.TargetedSpace().GUID, cmd.Labels, cmd.OmitStats) |
| 39 | cmd.UI.DisplayWarnings(warnings) |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | |
| 44 | if len(summaries) == 0 { |
| 45 | cmd.UI.DisplayText("No apps found") |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | fields := []string{ |
| 50 | cmd.UI.TranslateText("name"), |
| 51 | cmd.UI.TranslateText("requested state"), |
| 52 | } |
| 53 | |
| 54 | if !cmd.OmitStats { |
| 55 | fields = append(fields, cmd.UI.TranslateText("processes")) |
| 56 | } |
| 57 | |
| 58 | fields = append(fields, cmd.UI.TranslateText("routes")) |
| 59 | |
| 60 | table := [][]string{fields} |
| 61 | |
| 62 | for _, summary := range summaries { |
| 63 | tableRow := []string{ |
| 64 | summary.Name, |
| 65 | cmd.UI.TranslateText(strings.ToLower(string(summary.State))), |
| 66 | } |
| 67 | if !cmd.OmitStats { |
| 68 | tableRow = append(tableRow, summary.ProcessSummaries.String()) |
| 69 | } |
| 70 | tableRow = append(tableRow, getURLs(summary.Routes)) |
| 71 | table = append(table, tableRow) |
| 72 | } |
| 73 | |
| 74 | cmd.UI.DisplayTableWithHeader("", table, ui.DefaultTableSpacePadding) |
| 75 | |
| 76 | return nil |
| 77 | } |
nothing calls this directly
no test coverage detected