networkNames contacts the API to get a list of network names. In case of an error, an empty list is returned.
(dockerCLI completion.APIClientProvider, cmd *cobra.Command)
| 211 | // networkNames contacts the API to get a list of network names. |
| 212 | // In case of an error, an empty list is returned. |
| 213 | func networkNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string { |
| 214 | res, err := dockerCLI.Client().NetworkList(cmd.Context(), client.NetworkListOptions{}) |
| 215 | if err != nil { |
| 216 | return []string{} |
| 217 | } |
| 218 | names := make([]string, 0, len(res.Items)) |
| 219 | for _, nw := range res.Items { |
| 220 | names = append(names, nw.Name) |
| 221 | } |
| 222 | return names |
| 223 | } |
| 224 | |
| 225 | // nodeNames contacts the API to get a list of node names. |
| 226 | // In case of an error, an empty list is returned. |
no test coverage detected
searching dependent graphs…