MCPcopy Index your code
hub / github.com/docker/cli / completeVolumeDriver

Function completeVolumeDriver

cli/command/container/completion.go:310–320  ·  view source on GitHub ↗

completeVolumeDriver contacts the API to get the built-in and installed volume drivers.

(dockerCLI completion.APIClientProvider)

Source from the content-addressed store, hash-verified

308
309// completeVolumeDriver contacts the API to get the built-in and installed volume drivers.
310func 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.

Callers 1

addCompletionsFunction · 0.85

Calls 2

ClientMethod · 0.65
InfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…