Skip to content

Commit

Permalink
Extend routes output by options
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariquest committed Dec 10, 2024
1 parent 2625676 commit 7a61d11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 7 additions & 1 deletion cf/commands/route/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (cmd *ListRoutes) Execute(c flags.FlagContext) error {
}))
}

table := cmd.ui.Table([]string{T("space"), T("host"), T("domain"), T("port"), T("path"), T("type"), T("apps"), T("service")})
table := cmd.ui.Table([]string{T("space"), T("host"), T("domain"), T("port"), T("path"), T("type"), T("apps"), T("service"), T("options")})

d := make(map[string]models.DomainFields)
err := cmd.domainRepo.ListDomainsForOrg(cmd.config.OrganizationFields().GUID, func(domain models.DomainFields) bool {
Expand All @@ -113,6 +113,11 @@ func (cmd *ListRoutes) Execute(c flags.FlagContext) error {
appNames = append(appNames, app.Name)
}

options := []string{}
for optionKey, optionValue := range route.Options {
options = append(options, fmt.Sprintf("%s: %s", optionKey, optionValue))
}

var port string
if route.Port != 0 {
port = fmt.Sprintf("%d", route.Port)
Expand All @@ -129,6 +134,7 @@ func (cmd *ListRoutes) Execute(c flags.FlagContext) error {
domain.RouterGroupType,
strings.Join(appNames, ","),
route.ServiceInstance.Name,
strings.Join(options, ","),
)
return true
}
Expand Down
20 changes: 11 additions & 9 deletions cf/models/route_summary.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package models

type RouteSummary struct {
GUID string
Host string
Domain DomainFields
Path string
Port int
GUID string
Host string
Domain DomainFields
Path string
Port int
Options map[string]string
}

func (r RouteSummary) URL() string {
return (&RoutePresenter{
Host: r.Host,
Domain: r.Domain.Name,
Path: r.Path,
Port: r.Port,
Host: r.Host,
Domain: r.Domain.Name,
Path: r.Path,
Port: r.Port,
Options: r.Options,
}).URL()
}

0 comments on commit 7a61d11

Please sign in to comment.