MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Execute

Method Execute

command/v7/route_command.go:37–110  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

35}
36
37func (cmd RouteCommand) Execute(args []string) error {
38 err := cmd.SharedActor.CheckTarget(true, false)
39 if err != nil {
40 return err
41 }
42
43 user, err := cmd.Actor.GetCurrentUser()
44 if err != nil {
45 return err
46 }
47
48 domain, warnings, err := cmd.Actor.GetDomainByName(cmd.RequiredArgs.Domain)
49
50 cmd.UI.DisplayWarnings(warnings)
51 if err != nil {
52 return err
53 }
54
55 hostName := ""
56 if cmd.Hostname != "" {
57 hostName = cmd.Hostname + "."
58 }
59
60 displayPort := ""
61 if cmd.Port != 0 {
62 displayPort = ":" + strconv.Itoa(cmd.Port)
63
64 }
65
66 cmd.UI.DisplayTextWithFlavor(" Showing route {{.HostName}}{{.DomainName}}{{.Port}}{{.PathName}} in org {{.OrgName}} / space {{.SpaceName}} as {{.Username}}...", map[string]interface{}{
67 "HostName": hostName,
68 "DomainName": cmd.RequiredArgs.Domain,
69 "PathName": cmd.Path.Path,
70 "Port": displayPort,
71 "OrgName": cmd.Config.TargetedOrganization().Name,
72 "SpaceName": cmd.Config.TargetedSpace().Name,
73 "Username": user.Name,
74 })
75 cmd.UI.DisplayNewline()
76
77 route, warnings, err := cmd.Actor.GetRouteByAttributes(domain, cmd.Hostname, cmd.Path.Path, cmd.Port)
78 cmd.UI.DisplayWarnings(warnings)
79 if err != nil {
80 return err
81 }
82
83 port := ""
84 if route.Port != 0 {
85 port = strconv.Itoa(route.Port)
86 }
87
88 appMap, warnings, err := cmd.Actor.GetApplicationMapForRoute(route)
89 cmd.UI.DisplayWarnings(warnings)
90 if err != nil {
91 return err
92 }
93
94 table := [][]string{

Callers

nothing calls this directly

Calls 15

displayDestinationsMethod · 0.95
FormattedOptionsMethod · 0.80
CheckTargetMethod · 0.65
GetCurrentUserMethod · 0.65
GetDomainByNameMethod · 0.65
DisplayWarningsMethod · 0.65
DisplayTextWithFlavorMethod · 0.65
TargetedOrganizationMethod · 0.65
TargetedSpaceMethod · 0.65
DisplayNewlineMethod · 0.65
GetRouteByAttributesMethod · 0.65

Tested by

no test coverage detected