serviceNames contacts the API to get a list of service names. In case of an error, an empty list is returned.
(dockerCLI completion.APIClientProvider, cmd *cobra.Command)
| 267 | // serviceNames contacts the API to get a list of service names. |
| 268 | // In case of an error, an empty list is returned. |
| 269 | func serviceNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string { |
| 270 | res, err := dockerCLI.Client().ServiceList(cmd.Context(), client.ServiceListOptions{}) |
| 271 | if err != nil { |
| 272 | return []string{} |
| 273 | } |
| 274 | names := make([]string, 0, len(res.Items)) |
| 275 | for _, v := range res.Items { |
| 276 | names = append(names, v.Spec.Name) |
| 277 | } |
| 278 | return names |
| 279 | } |
| 280 | |
| 281 | // taskNames contacts the API to get a list of service names. |
| 282 | // In case of an error, an empty list is returned. |
no test coverage detected
searching dependent graphs…