Skip to content

Commit

Permalink
Print 'no resource found' in show cmds
Browse files Browse the repository at this point in the history
Signed-off-by: Maayan Friedman <[email protected]>
  • Loading branch information
maayanf24 authored and tpantelis committed Aug 13, 2020
1 parent aeef2cd commit 0019750
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/subctl/cmd/show_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ func showConnectionsFromConfig(config *rest.Config) {
}

func printConnections(connections []connectionStatus) {
template := "%-20s%-16s%-16s%-24s%-40s%-16s\n"
if len(connections) == 0 {
fmt.Println("No resources found.")
return
}

template := "%-20s%-16s%-16s%-24s%-40s%-16s\n"
fmt.Printf(template, "GATEWAY", "CLUSTER", "REMOTE IP", "CABLE DRIVER", "SUBNETS", "STATUS")

for _, item := range connections {
Expand Down
5 changes: 5 additions & 0 deletions pkg/subctl/cmd/show_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func showEndpointsFromConfig(config *rest.Config) {
}

func printEndpoints(endpoints []endpointStatus) {
if len(endpoints) == 0 {
fmt.Println("No resources found.")
return
}

template := "%-16s%-16s%-20s%-20s%-16s\n"

fmt.Printf(template, "CLUSTER ID", "ENDPOINT IP", "PUBLIC IP", "CABLE DRIVER", "TYPE")
Expand Down
6 changes: 6 additions & 0 deletions pkg/subctl/cmd/show_gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ func showGatewaysFromConfig(config *rest.Config) {
}

func printGateways(gateways []gatewayStatus) {
if len(gateways) == 0 {
fmt.Println("No resources found.")
return
}

template := "%-20s%-16s%-32s\n"
fmt.Printf(template, "NODE", "HA STATUS", "SUMMARY")

for _, item := range gateways {
fmt.Printf(
template,
Expand Down

0 comments on commit 0019750

Please sign in to comment.