completeVolumeDriver contacts the API to get the built-in and installed volume drivers.
(dockerCLI completion.APIClientProvider)
| 308 | |
| 309 | // completeVolumeDriver contacts the API to get the built-in and installed volume drivers. |
| 310 | func completeVolumeDriver(dockerCLI completion.APIClientProvider) cobra.CompletionFunc { |
| 311 | return func(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) { |
| 312 | res, err := dockerCLI.Client().Info(cmd.Context(), client.InfoOptions{}) |
| 313 | if err != nil { |
| 314 | // fallback: the built-in drivers |
| 315 | return []string{"local"}, cobra.ShellCompDirectiveNoFileComp |
| 316 | } |
| 317 | drivers := res.Info.Plugins.Volume |
| 318 | return drivers, cobra.ShellCompDirectiveNoFileComp |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // containerNames contacts the API to get names and optionally IDs of containers. |
| 323 | // In case of an error, an empty list is returned. |
no test coverage detected
searching dependent graphs…