volumeNames contacts the API to get a list of volume names. In case of an error, an empty list is returned.
(dockerCLI completion.APIClientProvider, cmd *cobra.Command)
| 305 | // volumeNames contacts the API to get a list of volume names. |
| 306 | // In case of an error, an empty list is returned. |
| 307 | func volumeNames(dockerCLI completion.APIClientProvider, cmd *cobra.Command) []string { |
| 308 | res, err := dockerCLI.Client().VolumeList(cmd.Context(), client.VolumeListOptions{}) |
| 309 | if err != nil { |
| 310 | return []string{} |
| 311 | } |
| 312 | names := make([]string, 0, len(res.Items)) |
| 313 | for _, v := range res.Items { |
| 314 | names = append(names, v.Name) |
| 315 | } |
| 316 | return names |
| 317 | } |
| 318 | |
| 319 | // completeObjectNames completes names of objects based on the "--type" flag |
| 320 | // |
no test coverage detected
searching dependent graphs…