(out io.Writer, file providers.File, names []string)
| 100 | } |
| 101 | |
| 102 | func writeProviderTable(out io.Writer, file providers.File, names []string) { |
| 103 | nameWidth := len("NAME") |
| 104 | endpointWidth := len("ENDPOINT") |
| 105 | clientsWidth := len("CLIENTS") |
| 106 | for _, n := range names { |
| 107 | if len(n) > nameWidth { |
| 108 | nameWidth = len(n) |
| 109 | } |
| 110 | ep := file.Endpoints[n] |
| 111 | if len(ep.Endpoint) > endpointWidth { |
| 112 | endpointWidth = len(ep.Endpoint) |
| 113 | } |
| 114 | clients := joinComma(ep.Clients()) |
| 115 | if len(clients) > clientsWidth { |
| 116 | clientsWidth = len(clients) |
| 117 | } |
| 118 | } |
| 119 | row := fmt.Sprintf("%%-%ds %%-%ds %%-%ds %%s\n", nameWidth, endpointWidth, clientsWidth) |
| 120 | fmt.Fprintf(out, row, "NAME", "ENDPOINT", "CLIENTS", "ENABLED") |
| 121 | for _, n := range names { |
| 122 | ep := file.Endpoints[n] |
| 123 | fmt.Fprintf(out, row, n, ep.Endpoint, joinComma(ep.Clients()), enabledString(ep)) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | func enabledString(ep providers.Endpoint) string { |
| 128 | if ep.IsEnabled() { |
no test coverage detected